diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-27 22:46:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-27 22:46:09 +0000 |
commit | cb03f8547d9e0f4cf70d5eec226f2ccfbc8fdfe4 (patch) | |
tree | aed52ddb77abba50bdac929d3f667f8b426de8fb /lib | |
parent | d2f0db1b1966a8d1237b15a2b2acebce9ad4a6eb (diff) | |
download | external_llvm-cb03f8547d9e0f4cf70d5eec226f2ccfbc8fdfe4.zip external_llvm-cb03f8547d9e0f4cf70d5eec226f2ccfbc8fdfe4.tar.gz external_llvm-cb03f8547d9e0f4cf70d5eec226f2ccfbc8fdfe4.tar.bz2 |
simplify this logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60189 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/DCE.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp index fb9a0e0..a5990ee 100644 --- a/lib/Transforms/Scalar/DCE.cpp +++ b/lib/Transforms/Scalar/DCE.cpp @@ -39,12 +39,14 @@ namespace { 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; } |