mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-10 20:33:15 +00:00
simplify this logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60189 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d2f0db1b19
commit
cb03f8547d
@ -39,12 +39,14 @@ namespace {
|
|||||||
DeadInstElimination() : BasicBlockPass(intptr_t(&ID)) {}
|
DeadInstElimination() : BasicBlockPass(intptr_t(&ID)) {}
|
||||||
virtual bool runOnBasicBlock(BasicBlock &BB) {
|
virtual bool runOnBasicBlock(BasicBlock &BB) {
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); )
|
for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); ) {
|
||||||
if (dceInstruction(DI)) {
|
Instruction *Inst = DI++;
|
||||||
|
if (isInstructionTriviallyDead(Inst)) {
|
||||||
|
Inst->eraseFromParent();
|
||||||
Changed = true;
|
Changed = true;
|
||||||
++DIEEliminated;
|
++DIEEliminated;
|
||||||
} else
|
}
|
||||||
++DI;
|
}
|
||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user