diff options
author | Chris Lattner <sabre@nondot.org> | 2004-04-10 07:02:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-04-10 07:02:02 +0000 |
commit | 17177601fb9fa065a6159a116832eb6e3ce6e9b1 (patch) | |
tree | 53f07149f991ab9c251f34b4492617aa175b1eef | |
parent | 0190fdba448c6580a724b37b019978ef84704584 (diff) |
Correctly update counters
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12810 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/ADCE.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index afc24f95f1..18c11c3ade 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -144,13 +144,16 @@ bool ADCE::dropReferencesOfDeadInstructionsInLiveBlock(BasicBlock *BB) { // #arguments != #predecessors, so we remove them now. // PN->replaceAllUsesWith(Constant::getNullValue(PN->getType())); + + } else { + if (isa<CallInst>(I)) + ++NumCallRemoved; + else + ++NumInstRemoved; // Delete the instruction... - I = BB->getInstList().erase(I); + BB->getInstList().erase(I++); Changed = true; - ++NumInstRemoved; - } else { - ++I; } } else { ++I; @@ -497,8 +500,11 @@ bool ADCE::doADCE() { for (BasicBlock::iterator II = BI->begin(); II != --BI->end(); ) if (!LiveSet.count(II)) { // Is this instruction alive? // Nope... remove the instruction from it's basic block... + if (isa<CallInst>(II)) + ++NumCallRemoved; + else + ++NumInstRemoved; II = BI->getInstList().erase(II); - ++NumInstRemoved; MadeChanges = true; } else { ++II; |