summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/AliasAnalysis.cpp
diff options
context:
space:
mode:
authorAlina Sbirlea <asbirlea@google.com>2019-04-30 22:15:47 +0000
committerAlina Sbirlea <asbirlea@google.com>2019-04-30 22:15:47 +0000
commitba48a2c5e856fd4221a0551d3b480a1b7fccac02 (patch)
treedc57b4e930779b842f77877b354dc28007235469 /llvm/lib/Analysis/AliasAnalysis.cpp
parenta6322941ffc15275e837435eee7aabba0ca15211 (diff)
downloadbcm5719-llvm-ba48a2c5e856fd4221a0551d3b480a1b7fccac02.tar.gz
bcm5719-llvm-ba48a2c5e856fd4221a0551d3b480a1b7fccac02.zip
[AliasAnalysis/NewPassManager] Invalidate AAManager less often.
Summary: This is a redo of D60914. The objective is to not invalidate AAManager, which is stateless, unless there is an explicit invalidate in one of the AAResults. To achieve this, this patch adds an API to PAC, to check precisely this: is this analysis not invalidated explicitly == is this analysis not abandoned == is this analysis stateless, so preserved without explicitly being marked as preserved by everyone Reviewers: chandlerc Subscribers: mehdi_amini, jlebar, george.burgess.iv, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61284 llvm-svn: 359622
Diffstat (limited to 'llvm/lib/Analysis/AliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/AliasAnalysis.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 06a33f659c1..32241e355eb 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -79,12 +79,16 @@ AAResults::~AAResults() {
bool AAResults::invalidate(Function &F, const PreservedAnalyses &PA,
FunctionAnalysisManager::Invalidator &Inv) {
- // Check if the AA manager itself has been invalidated.
+ // AAResults preserves the AAManager by default, due to the stateless nature
+ // of AliasAnalysis. There is no need to check whether it has been preserved
+ // explicitly. Check if any module dependency was invalidated and caused the
+ // AAManager to be invalidated. Invalidate ourselves in that case.
auto PAC = PA.getChecker<AAManager>();
- if (!PAC.preserved() && !PAC.preservedSet<AllAnalysesOn<Function>>())
- return true; // The manager needs to be blown away, clear everything.
+ if (!PAC.preservedWhenStateless())
+ return true;
- // Check all of the dependencies registered.
+ // Check if any of the function dependencies were invalidated, and invalidate
+ // ourselves in that case.
for (AnalysisKey *ID : AADeps)
if (Inv.invalidate(ID, F, PA))
return true;
OpenPOWER on IntegriCloud