aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/IndVarSimplify.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-04-02 14:48:31 +0000
committerDan Gohman <gohman@apple.com>2010-04-02 14:48:31 +0000
commit23b05505def73105d4bf2b223d020dc762a2d181 (patch)
treeb9ec0d98e7b147ce3b71e5279231e7e17274158f /lib/Transforms/Scalar/IndVarSimplify.cpp
parent53108421c4660576a2cfc1cbd2ec3c026a582323 (diff)
downloadexternal_llvm-23b05505def73105d4bf2b223d020dc762a2d181.zip
external_llvm-23b05505def73105d4bf2b223d020dc762a2d181.tar.gz
external_llvm-23b05505def73105d4bf2b223d020dc762a2d181.tar.bz2
Manually notify ScalarEvolution before making an operand replacement, since
it can't currently observe such changes automatically. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100186 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 988a4cb..2722a66 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -510,6 +510,13 @@ void IndVarSimplify::RewriteIVExpressions(Loop *L, SCEVExpander &Rewriter) {
// Now expand it into actual Instructions and patch it into place.
Value *NewVal = Rewriter.expandCodeFor(AR, UseTy, InsertPt);
+ // Inform ScalarEvolution that this value is changing. The change doesn't
+ // affect its value, but it does potentially affect which use lists the
+ // value will be on after the replacement, which affects ScalarEvolution's
+ // ability to walk use lists and drop dangling pointers when a value is
+ // deleted.
+ SE->forgetValue(User);
+
// Patch the new value into place.
if (Op->hasName())
NewVal->takeName(Op);