aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/IndVarSimplify.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2007-06-06 03:51:56 +0000
committerNick Lewycky <nicholas@mxc.ca>2007-06-06 03:51:56 +0000
commit5adcefb04d70c3cb493c28bdc48da554f6960cb4 (patch)
treee9cc030b23812f06ce9fec364f752e00433f638f /lib/Transforms/Scalar/IndVarSimplify.cpp
parent3d6f60ec19e8c29d2b06eadb992c3b8380d60585 (diff)
Inform ScalarEvolutions that we're deleting Values.
This is the obviously correct part of the fix for PR1487. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37457 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 20eb3a8521..8042d62581 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -181,6 +181,7 @@ void IndVarSimplify::EliminatePointerRecurrence(PHINode *PN,
GetElementPtrInst *NGEPI = new GetElementPtrInst(
NCE, Constant::getNullValue(Type::Int32Ty), NewAdd,
GEPI->getName(), GEPI);
+ SE->deleteInstructionFromRecords(GEPI);
GEPI->replaceAllUsesWith(NGEPI);
GEPI->eraseFromParent();
GEPI = NGEPI;
@@ -398,6 +399,7 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L) {
// the PHI entirely. This is safe, because the NewVal won't be variant
// in the loop, so we don't need an LCSSA phi node anymore.
if (NumPreds == 1) {
+ SE->deleteInstructionFromRecords(PN);
PN->replaceAllUsesWith(ExitVal);
PN->eraseFromParent();
break;