diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2016-07-18 19:14:14 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2016-07-18 19:14:14 +0000 |
| commit | 04854ab1e5adb48677ba1740e4ffbd929638ec23 (patch) | |
| tree | 0ee6edb88955b32dbbaa76fb2702d1026c51586c /llvm/lib | |
| parent | 7a3040dc839bacd4d8230c7531033017b482172b (diff) | |
| download | bcm5719-llvm-04854ab1e5adb48677ba1740e4ffbd929638ec23.tar.gz bcm5719-llvm-04854ab1e5adb48677ba1740e4ffbd929638ec23.zip | |
[GVNHoist] Remove a home-grown version of replaceUsesOfWith
replaceUsesOfWith will, on average, consider fewer values when trying
to do the replacement.
No functional change is intended.
llvm-svn: 275884
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/GVNHoist.cpp | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp index c53263ac194..71f992ef8ff 100644 --- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp +++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp @@ -574,19 +574,6 @@ public: llvm_unreachable("Both I and J must be from same BB"); } - // Replace the use of From with To in Insn. - void replaceUseWith(Instruction *Insn, Value *From, Value *To) const { - for (Value::use_iterator UI = From->use_begin(), UE = From->use_end(); - UI != UE;) { - Use &U = *UI++; - if (U.getUser() == Insn) { - U.set(To); - return; - } - } - llvm_unreachable("should replace exactly once"); - } - bool makeOperandsAvailable(Instruction *Repl, BasicBlock *HoistPt) const { // Check whether the GEP of a ld/st can be synthesized at HoistPt. Instruction *Gep = nullptr; @@ -612,13 +599,13 @@ public: // Copy the gep before moving the ld/st. Instruction *ClonedGep = Gep->clone(); ClonedGep->insertBefore(HoistPt->getTerminator()); - replaceUseWith(Repl, Gep, ClonedGep); + Repl->replaceUsesOfWith(Gep, ClonedGep); // Also copy Val. if (Val) { Instruction *ClonedVal = Val->clone(); ClonedVal->insertBefore(HoistPt->getTerminator()); - replaceUseWith(Repl, Val, ClonedVal); + Repl->replaceUsesOfWith(Val, ClonedVal); } return true; |

