diff options
author | Dan Gohman <gohman@apple.com> | 2010-03-20 03:53:53 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-03-20 03:53:53 +0000 |
commit | 1a2abe55806c8c9e7950f0f7a9224c343e22f90b (patch) | |
tree | d36b79d17b3739a4b18552ed6d69e8c775cb5e1b /llvm/lib/Transforms | |
parent | b8d1fd05536636dfd170ced22d150a819163c3b3 (diff) | |
download | bcm5719-llvm-1a2abe55806c8c9e7950f0f7a9224c343e22f90b.tar.gz bcm5719-llvm-1a2abe55806c8c9e7950f0f7a9224c343e22f90b.zip |
Clear the SCEVExpander's insertion point after making deletions,
so that the SCEVExpander doesn't retain a dangling pointer as its
insert position. The dangling pointer in this case wasn't ever used
to insert new instructions, but it was causing trouble with
SCEVExpander's code for automatically advancing its insert position
past debug intrinsics.
This fixes use-after-free errors that valgrind noticed in
test/Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll and
test/Transforms/IndVarSimplify/exit_value_tests.ll.
llvm-svn: 99036
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index de93e9f621f..eb04d9401fb 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -307,6 +307,10 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L, } } } + + // The insertion point instruction may have been deleted; clear it out + // so that the rewriter doesn't trip over it later. + Rewriter.clearInsertPoint(); } void IndVarSimplify::RewriteNonIntegerIVs(Loop *L) { |