summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/CGSCCPassManager.cpp2
-rw-r--r--llvm/lib/Analysis/LoopAnalysisManager.cpp2
-rw-r--r--llvm/lib/Analysis/LoopInfo.cpp4
-rw-r--r--llvm/lib/Analysis/LoopPass.cpp26
4 files changed, 20 insertions, 14 deletions
diff --git a/llvm/lib/Analysis/CGSCCPassManager.cpp b/llvm/lib/Analysis/CGSCCPassManager.cpp
index cd115c97ef6..ceff94756fe 100644
--- a/llvm/lib/Analysis/CGSCCPassManager.cpp
+++ b/llvm/lib/Analysis/CGSCCPassManager.cpp
@@ -235,7 +235,7 @@ bool FunctionAnalysisManagerCGSCCProxy::Result::invalidate(
auto PAC = PA.getChecker<FunctionAnalysisManagerCGSCCProxy>();
if (!PAC.preserved() && !PAC.preservedSet<AllAnalysesOn<LazyCallGraph::SCC>>()) {
for (LazyCallGraph::Node &N : C)
- FAM->clear(N.getFunction());
+ FAM->clear(N.getFunction(), N.getFunction().getName());
return true;
}
diff --git a/llvm/lib/Analysis/LoopAnalysisManager.cpp b/llvm/lib/Analysis/LoopAnalysisManager.cpp
index e4a0f90b2f7..84a891c3f4f 100644
--- a/llvm/lib/Analysis/LoopAnalysisManager.cpp
+++ b/llvm/lib/Analysis/LoopAnalysisManager.cpp
@@ -57,7 +57,7 @@ bool LoopAnalysisManagerFunctionProxy::Result::invalidate(
// those results. Note that the order doesn't matter here as this will just
// directly destroy the results without calling methods on them.
for (Loop *L : PreOrderLoops)
- InnerAM->clear(*L);
+ InnerAM->clear(*L, L->getName());
// We also need to null out the inner AM so that when the object gets
// destroyed as invalid we don't try to clear the inner AM again. At that
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp
index 041b39aad09..0471213b69c 100644
--- a/llvm/lib/Analysis/LoopInfo.cpp
+++ b/llvm/lib/Analysis/LoopInfo.cpp
@@ -620,10 +620,8 @@ bool LoopInfo::invalidate(Function &F, const PreservedAnalyses &PA,
void LoopInfo::erase(Loop *Unloop) {
assert(!Unloop->isInvalid() && "Loop has already been erased!");
- RemovedLoops.push_back(Unloop);
- auto InvalidateOnExit =
- make_scope_exit([&]() { BaseT::clearLoop(*Unloop); });
+ auto InvalidateOnExit = make_scope_exit([&]() { destroy(Unloop); });
// First handle the special case of no parent loop to simplify the algorithm.
if (!Unloop->getParentLoop()) {
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)
-
OpenPOWER on IntegriCloud