Correctly update counters

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12810 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-04-10 07:02:02 +00:00
parent 0190fdba44
commit 17177601fb

View File

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