diff options
Diffstat (limited to 'lib/Transforms/Scalar/ADCE.cpp')
-rw-r--r-- | lib/Transforms/Scalar/ADCE.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index 18c11c3ade..8adf630f91 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -145,15 +145,13 @@ bool ADCE::dropReferencesOfDeadInstructionsInLiveBlock(BasicBlock *BB) { // PN->replaceAllUsesWith(Constant::getNullValue(PN->getType())); - } else { - if (isa<CallInst>(I)) - ++NumCallRemoved; - else - ++NumInstRemoved; - // Delete the instruction... - BB->getInstList().erase(I++); + ++I; + BB->getInstList().erase(PN); Changed = true; + ++NumInstRemoved; + } else { + ++I; } } else { ++I; |