From 6149ac89919d49c87875134ea7402db73b6fe84f Mon Sep 17 00:00:00 2001 From: Chris Lattner <sabre@nondot.org> Date: Sat, 10 Apr 2004 07:02:02 +0000 Subject: [PATCH] Correctly update counters llvm-svn: 12810 --- llvm/lib/Transforms/Scalar/ADCE.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp index afc24f95f11b..18c11c3adee1 100644 --- a/llvm/lib/Transforms/Scalar/ADCE.cpp +++ b/llvm/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;