When a loop is deleted, immediately release all of the active
authorDan Gohman <gohman@apple.com>
Sun, 27 Sep 2009 23:43:07 +0000 (23:43 +0000)
committerDan Gohman <gohman@apple.com>
Sun, 27 Sep 2009 23:43:07 +0000 (23:43 +0000)
LoopPasses for that loop. This avoids trouble with the PassManager
trying to call verifyAnalysis on them, and frees up some memory
sooner rather than later.

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

lib/Analysis/LoopPass.cpp

index 08615c4e14e5e107dfa03f13ad5f6e7efa362a6a..4f7018da1ace83b66584a80e5094347e2feb95fd 100644 (file)
@@ -253,6 +253,15 @@ bool LPPassManager::runOnFunction(Function &F) {
         break;
     }
     
+    // If the loop was deleted, release all the loop passes. This frees up
+    // some memory, and avoids trouble with the pass manager trying to call
+    // verifyAnalysis on them.
+    if (skipThisLoop)
+      for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {  
+        Pass *P = getContainedPass(Index);
+        freePass(P, "", ON_LOOP_MSG);
+      }
+
     // Pop the loop from queue after running all passes.
     LQ.pop_back();