diff options
Diffstat (limited to 'llvm/lib/Analysis/LoopPass.cpp')
-rw-r--r-- | llvm/lib/Analysis/LoopPass.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/LoopPass.cpp b/llvm/lib/Analysis/LoopPass.cpp index 6496c6039e4..ce3cb2ab183 100644 --- a/llvm/lib/Analysis/LoopPass.cpp +++ b/llvm/lib/Analysis/LoopPass.cpp @@ -140,6 +140,13 @@ void LPPassManager::getAnalysisUsage(AnalysisUsage &Info) const { Info.setPreservesAll(); } +void LPPassManager::markLoopAsDeleted(Loop &L) { + assert((&L == CurrentLoop || CurrentLoop->contains(&L)) && + "Must not delete loop outside the current loop tree!"); + if (&L == CurrentLoop) + CurrentLoopDeleted = true; +} + /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the function, and if so, return true. bool LPPassManager::runOnFunction(Function &F) { @@ -176,7 +183,7 @@ bool LPPassManager::runOnFunction(Function &F) { // Walk Loops while (!LQ.empty()) { - bool LoopWasDeleted = false; + CurrentLoopDeleted = false; CurrentLoop = LQ.back(); // Run all passes on the current Loop. @@ -195,13 +202,14 @@ bool LPPassManager::runOnFunction(Function &F) { Changed |= P->runOnLoop(CurrentLoop, *this); } - LoopWasDeleted = CurrentLoop->isInvalid(); if (Changed) - dumpPassInfo(P, MODIFICATION_MSG, ON_LOOP_MSG, CurrentLoop->getName()); + dumpPassInfo(P, MODIFICATION_MSG, ON_LOOP_MSG, + CurrentLoopDeleted ? "<deleted loop>" + : CurrentLoop->getName()); dumpPreservedSet(P); - if (LoopWasDeleted) { + if (CurrentLoopDeleted) { // Notify passes that the loop is being deleted. deleteSimpleAnalysisLoop(CurrentLoop); } else { @@ -229,11 +237,12 @@ bool LPPassManager::runOnFunction(Function &F) { removeNotPreservedAnalysis(P); recordAvailableAnalysis(P); - removeDeadPasses(P, LoopWasDeleted ? "<deleted>" - : CurrentLoop->getHeader()->getName(), + removeDeadPasses(P, + CurrentLoopDeleted ? "<deleted>" + : CurrentLoop->getHeader()->getName(), ON_LOOP_MSG); - if (LoopWasDeleted) + if (CurrentLoopDeleted) // Do not run other passes on this loop. break; } @@ -241,7 +250,7 @@ bool LPPassManager::runOnFunction(Function &F) { // 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 (LoopWasDeleted) { + if (CurrentLoopDeleted) { for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { Pass *P = getContainedPass(Index); freePass(P, "<deleted>", ON_LOOP_MSG); @@ -359,4 +368,3 @@ bool LoopPass::skipLoop(const Loop *L) const { char LCSSAVerificationPass::ID = 0; INITIALIZE_PASS(LCSSAVerificationPass, "lcssa-verification", "LCSSA Verifier", false, false) - |