indvars -disable-iv-rewrite: ExprToMap lives in Pass data, so be more
authorAndrew Trick <atrick@apple.com>
Wed, 6 Jul 2011 21:07:10 +0000 (21:07 +0000)
committerAndrew Trick <atrick@apple.com>
Wed, 6 Jul 2011 21:07:10 +0000 (21:07 +0000)
careful about referencing values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134537 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/IndVarSimplify.cpp

index 477f42c50e0388206802e6bdba6a068ce435c622..31dbd42f2c03deee9fbff3377c77e9763820f11c 100644 (file)
@@ -81,7 +81,7 @@ static cl::opt<bool> DisableIVRewrite(
 
 namespace {
   class IndVarSimplify : public LoopPass {
-    typedef DenseMap<const SCEV *, PHINode *> ExprToIVMapTy;
+    typedef DenseMap< const SCEV *, AssertingVH<PHINode> > ExprToIVMapTy;
 
     IVUsers         *IU;
     LoopInfo        *LI;
@@ -1375,6 +1375,7 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
   // can be deleted in the loop below, causing the AssertingVH in the cache to
   // trigger.
   Rewriter.clear();
+  ExprToIVMap.clear();
 
   // Now that we're done iterating through lists, clean up any instructions
   // which are now dead.