[llvm-commits] [llvm] r60189 - /llvm/trunk/lib/Transforms/Scalar/DCE.cpp
Chris Lattner
sabre at nondot.org
Thu Nov 27 14:46:09 PST 2008
Author: lattner
Date: Thu Nov 27 16:46:09 2008
New Revision: 60189
URL: http://llvm.org/viewvc/llvm-project?rev=60189&view=rev
Log:
simplify this logic.
Modified:
llvm/trunk/lib/Transforms/Scalar/DCE.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/DCE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DCE.cpp?rev=60189&r1=60188&r2=60189&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/DCE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DCE.cpp Thu Nov 27 16:46:09 2008
@@ -39,12 +39,14 @@
DeadInstElimination() : BasicBlockPass(intptr_t(&ID)) {}
virtual bool runOnBasicBlock(BasicBlock &BB) {
bool Changed = false;
- for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); )
- if (dceInstruction(DI)) {
+ for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); ) {
+ Instruction *Inst = DI++;
+ if (isInstructionTriviallyDead(Inst)) {
+ Inst->eraseFromParent();
Changed = true;
++DIEEliminated;
- } else
- ++DI;
+ }
+ }
return Changed;
}
More information about the llvm-commits
mailing list