[PATCH] D22809: GVN-hoist: use DFS numbers instead of walking the instruction stream
Sebastian Pop via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 26 22:21:25 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL276840: GVN-hoist: use DFS numbers instead of walking the instruction stream (authored by spop).
Changed prior to commit:
https://reviews.llvm.org/D22809?vs=65513&id=65666#toc
Repository:
rL LLVM
https://reviews.llvm.org/D22809
Files:
llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
Index: llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
+++ llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
@@ -609,13 +609,6 @@
return true;
}
- Instruction *firstOfTwo(Instruction *I, Instruction *J) const {
- for (Instruction &I1 : *I->getParent())
- if (&I1 == I || &I1 == J)
- return &I1;
- llvm_unreachable("Both I and J must be from same BB");
- }
-
bool makeOperandsAvailable(Instruction *Repl, BasicBlock *HoistPt,
const SmallVecInsn &InstructionsToHoist) const {
// Check whether the GEP of a ld/st can be synthesized at HoistPt.
@@ -685,12 +678,12 @@
const SmallVecInsn &InstructionsToHoist = HP.second;
Instruction *Repl = nullptr;
for (Instruction *I : InstructionsToHoist)
- if (I->getParent() == HoistPt) {
+ if (I->getParent() == HoistPt)
// If there are two instructions in HoistPt to be hoisted in place:
// update Repl to be the first one, such that we can rename the uses
// of the second based on the first.
- Repl = !Repl ? I : firstOfTwo(Repl, I);
- }
+ if (!Repl || firstInBB(I, Repl))
+ Repl = I;
if (Repl) {
// Repl is already in HoistPt: it remains in place.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22809.65666.patch
Type: text/x-patch
Size: 1389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160727/87d18282/attachment.bin>
More information about the llvm-commits
mailing list