summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2017-01-13 06:09:54 +0000
committerSerge Pavlov <sepavloff@gmail.com>2017-01-13 06:09:54 +0000
commitd409411ef195329a24cea00589e9853ab6a5ace8 (patch)
tree31459227034048c2e1e5274200e73d075317eb6e /llvm/lib/Analysis
parentd30e6f7421f4b319f1203d660bbc89f09d8944f7 (diff)
downloadbcm5719-llvm-d409411ef195329a24cea00589e9853ab6a5ace8.tar.gz
bcm5719-llvm-d409411ef195329a24cea00589e9853ab6a5ace8.zip
Track validity of pass results
Running tests with expensive checks enabled exhibits some problems with verification of pass results. First, the pass verification may require results of analysis that are not available. For instance, verification of loop info requires results of dominator tree analysis. A pass may be marked as conserving loop info but does not need to be dependent on DominatorTreePass. When a pass manager tries to verify that loop info is valid, it needs dominator tree, but corresponding analysis may be already destroyed as no user of it remained. Another case is a pass that is skipped. For instance, entities with linkage available_externally do not need code generation and such passes are skipped for them. In this case result verification must also be skipped. To solve these problems this change introduces a special flag to the Pass structure to mark passes that have valid results. If this flag is reset, verifications dependent on the pass result are skipped. Differential Revision: https://reviews.llvm.org/D27190 llvm-svn: 291882
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/CallGraphSCCPass.cpp1
-rw-r--r--llvm/lib/Analysis/LoopInfo.cpp6
-rw-r--r--llvm/lib/Analysis/LoopPass.cpp1
3 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/CallGraphSCCPass.cpp b/llvm/lib/Analysis/CallGraphSCCPass.cpp
index 9cef7814415..290fd34cff5 100644
--- a/llvm/lib/Analysis/CallGraphSCCPass.cpp
+++ b/llvm/lib/Analysis/CallGraphSCCPass.cpp
@@ -414,6 +414,7 @@ bool CGPassManager::RunAllPassesOnSCC(CallGraphSCC &CurSCC, CallGraph &CG,
initializeAnalysisImpl(P);
// Actually run this pass on the current SCC.
+ P->setExecuted(true);
Changed |= RunPassOnSCC(P, CurSCC, CG,
CallGraphUpToDate, DevirtualizedCall);
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp
index f449ce94d57..1b5d6e5d1b7 100644
--- a/llvm/lib/Analysis/LoopInfo.cpp
+++ b/llvm/lib/Analysis/LoopInfo.cpp
@@ -722,8 +722,10 @@ void LoopInfoWrapperPass::verifyAnalysis() const {
// checking by default, LoopPass has been taught to call verifyLoop manually
// during loop pass sequences.
if (VerifyLoopInfo) {
- auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
- LI.verify(DT);
+ if (auto *Analysis = getAnalysisIfAvailable<DominatorTreeWrapperPass>()) {
+ auto &DT = Analysis->getDomTree();
+ LI.verify(DT);
+ }
}
}
diff --git a/llvm/lib/Analysis/LoopPass.cpp b/llvm/lib/Analysis/LoopPass.cpp
index 3f4a0794215..d3e697e5c61 100644
--- a/llvm/lib/Analysis/LoopPass.cpp
+++ b/llvm/lib/Analysis/LoopPass.cpp
@@ -198,6 +198,7 @@ bool LPPassManager::runOnFunction(Function &F) {
PassManagerPrettyStackEntry X(P, *CurrentLoop->getHeader());
TimeRegion PassTimer(getPassTimer(P));
+ P->setExecuted(true);
Changed |= P->runOnLoop(CurrentLoop, *this);
}
LoopWasDeleted = CurrentLoop->isInvalid();
OpenPOWER on IntegriCloud