summaryrefslogtreecommitdiff
path: root/lib/Analysis/PostDominators.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2017-01-15 06:32:49 +0000
committerChandler Carruth <chandlerc@gmail.com>2017-01-15 06:32:49 +0000
commit10dd00ced58bf0684baf484769eef4c8ce6772a6 (patch)
tree340123f975b129f8d098864264b345d866b68ce3 /lib/Analysis/PostDominators.cpp
parentaf2151d394ee6592bf9a0e21da4e7195036372c3 (diff)
[PM] Introduce an analysis set used to preserve all analyses over
a function's CFG when that CFG is unchanged. This allows transformation passes to simply claim they preserve the CFG and analysis passes to check for the CFG being preserved to remove the fanout of all analyses being listed in all passes. I've gone through and removed or cleaned up as many of the comments reminding us to do this as I could. Differential Revision: https://reviews.llvm.org/D28627 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292054 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PostDominators.cpp')
-rw-r--r--lib/Analysis/PostDominators.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp
index cb9438a2f92..1caf151546d 100644
--- a/lib/Analysis/PostDominators.cpp
+++ b/lib/Analysis/PostDominators.cpp
@@ -31,6 +31,15 @@ char PostDominatorTreeWrapperPass::ID = 0;
INITIALIZE_PASS(PostDominatorTreeWrapperPass, "postdomtree",
"Post-Dominator Tree Construction", true, true)
+bool PostDominatorTree::invalidate(Function &F, const PreservedAnalyses &PA,
+ FunctionAnalysisManager::Invalidator &) {
+ // Check whether the analysis, all analyses on functions, or the function's
+ // CFG have been preserved.
+ auto PAC = PA.getChecker<PostDominatorTreeAnalysis>();
+ return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Function>>() ||
+ PAC.preservedSet<CFGAnalyses>());
+}
+
bool PostDominatorTreeWrapperPass::runOnFunction(Function &F) {
DT.recalculate(F);
return false;