diff options
-rw-r--r-- | lib/Transforms/Scalar/GCSE.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp index 8ed8238806..bbefe8157f 100644 --- a/lib/Transforms/Scalar/GCSE.cpp +++ b/lib/Transforms/Scalar/GCSE.cpp @@ -160,11 +160,14 @@ void GCSE::ReplaceInstructionWith(Instruction *I, Value *V) { ++NumCallRemoved; // Keep track of calls eliminated ++NumInstRemoved; // Keep track of number of insts eliminated + // Update value numbering + getAnalysis<ValueNumbering>().deleteInstruction(I); + // If we are not replacing the instruction with a constant, we cannot do // anything special. if (!isa<Constant>(V)) { I->replaceAllUsesWith(V); - + // Erase the instruction from the program. I->getParent()->getInstList().erase(I); return; |