summaryrefslogtreecommitdiff
path: root/lib/Analysis/LoopPass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/LoopPass.cpp')
-rw-r--r--lib/Analysis/LoopPass.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp
index 08615c4e14..4f7018da1a 100644
--- a/lib/Analysis/LoopPass.cpp
+++ b/lib/Analysis/LoopPass.cpp
@@ -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();