simplify this logic.

llvm-svn: 60189
This commit is contained in:
Chris Lattner 2008-11-27 22:46:09 +00:00
parent f5d5d6026f
commit d3f7621acd

View File

@ -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;
}