From: Chris Lattner Date: Sat, 10 Apr 2004 07:02:02 +0000 (+0000) Subject: Correctly update counters X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=17177601fb9fa065a6159a116832eb6e3ce6e9b1 Correctly update counters git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12810 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index afc24f95f11..18c11c3adee 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(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(II)) + ++NumCallRemoved; + else + ++NumInstRemoved; II = BI->getInstList().erase(II); - ++NumInstRemoved; MadeChanges = true; } else { ++II;