[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat May 1 18:20:05 PDT 2004
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.195 -> 1.196
---
Log message:
Make sure the instruction combiner doesn't lose track of instructions
when replacing them, missing the opportunity to do simplifications
---
Diffs of the changes: (+6 -3)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.195 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.196
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.195 Thu Apr 29 23:37:52 2004
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat May 1 18:19:52 2004
@@ -2934,9 +2934,8 @@
bool Changed = false;
TD = &getAnalysis<TargetData>();
- for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i) {
- WorkList.push_back(&*i);
- }
+ for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i)
+ WorkList.push_back(&*i);
while (!WorkList.empty()) {
@@ -2997,6 +2996,10 @@
// Insert the new instruction into the basic block...
BasicBlock *InstParent = I->getParent();
InstParent->getInstList().insert(I, Result);
+
+ for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
+ if (Instruction *OpI = dyn_cast<Instruction>(I->getOperand(i)))
+ WorkList.push_back(OpI);
// Everything uses the new instruction now...
I->replaceAllUsesWith(Result);
More information about the llvm-commits
mailing list