diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-01-31 07:04:22 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-01-31 07:04:22 +0000 |
| commit | 94cfb281c31748162b621b2c7a54a892be4472ce (patch) | |
| tree | 67f5840da18e0bf9fa41b6634b3e79792a25804c /llvm/lib/Transforms/Scalar/InstructionCombining.cpp | |
| parent | b6080cf943c43e10176c47f9cb50ee20f69cca3a (diff) | |
| download | bcm5719-llvm-94cfb281c31748162b621b2c7a54a892be4472ce.tar.gz bcm5719-llvm-94cfb281c31748162b621b2c7a54a892be4472ce.zip | |
make sure to set Changed=true when instcombine hacks on the code,
not doing so prevents it from properly iterating and prevents it
from deleting the entire body of dce-iterate.ll
llvm-svn: 63476
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 7f7592840a4..6c571511e7c 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -12356,6 +12356,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { if (!I->use_empty()) I->replaceAllUsesWith(UndefValue::get(I->getType())); I->eraseFromParent(); + Changed = true; } } } @@ -12375,6 +12376,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { I->eraseFromParent(); RemoveFromWorkList(I); + Changed = true; continue; } @@ -12389,17 +12391,19 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { ++NumConstProp; I->eraseFromParent(); RemoveFromWorkList(I); + Changed = true; continue; } if (TD && I->getType()->getTypeID() == Type::VoidTyID) { // See if we can constant fold its operands. - for (User::op_iterator i = I->op_begin(), e = I->op_end(); i != e; ++i) { - if (ConstantExpr *CE = dyn_cast<ConstantExpr>(i)) { + for (User::op_iterator i = I->op_begin(), e = I->op_end(); i != e; ++i) + if (ConstantExpr *CE = dyn_cast<ConstantExpr>(i)) if (Constant *NewC = ConstantFoldConstantExpression(CE, TD)) - i->set(NewC); - } - } + if (NewC != CE) { + i->set(NewC); + Changed = true; + } } // See if we can trivially sink this instruction to a successor basic block. |

