[PATCH] D71093: [InstCombine] Insert instructions before adding them to worklist
Jakub Kuderski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 6 08:20:13 PST 2019
kuhar updated this revision to Diff 232572.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71093/new/
https://reviews.llvm.org/D71093
Files:
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Index: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -3343,8 +3343,7 @@
++NumCombined;
// Should we replace the old instruction with a new one?
if (Result != I) {
- LLVM_DEBUG(dbgs() << "IC: Old = " << *I << '\n'
- << " New = " << *Result << '\n');
+ LLVM_DEBUG(dbgs() << "IC: Old = " << *I << '\n');
if (I->getDebugLoc())
Result->setDebugLoc(I->getDebugLoc());
@@ -3354,10 +3353,6 @@
// Move the name to the new instruction first.
Result->takeName(I);
- // Push the new instruction and any users onto the worklist.
- Worklist.AddUsersToWorkList(*Result);
- Worklist.Add(Result);
-
// Insert the new instruction into the basic block...
BasicBlock *InstParent = I->getParent();
BasicBlock::iterator InsertPos = I->getIterator();
@@ -3369,6 +3364,10 @@
InstParent->getInstList().insert(InsertPos, Result);
+ // Push the new instruction and any users onto the worklist.
+ Worklist.AddUsersToWorkList(*Result);
+ Worklist.Add(Result);
+
eraseInstFromFunction(*I);
} else {
LLVM_DEBUG(dbgs() << "IC: Mod = " << OrigI << '\n'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71093.232572.patch
Type: text/x-patch
Size: 1436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191206/b73cddc8/attachment.bin>
More information about the llvm-commits
mailing list