summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/AliasAnalysis.cpp
diff options
context:
space:
mode:
authorAlina Sbirlea <asbirlea@google.com>2019-04-24 00:28:29 +0000
committerAlina Sbirlea <asbirlea@google.com>2019-04-24 00:28:29 +0000
commitb341efce31feb12f416bc01b62fd4c47fb223903 (patch)
tree73320fb05183526541fc3b630318f3ec590f0368 /llvm/lib/Analysis/AliasAnalysis.cpp
parent06d2fa7b47b36369797cfd2bf128f80ce2fef3f9 (diff)
downloadbcm5719-llvm-b341efce31feb12f416bc01b62fd4c47fb223903.tar.gz
bcm5719-llvm-b341efce31feb12f416bc01b62fd4c47fb223903.zip
Revert [AliasAnalysis] AAResults preserves AAManager.
Triggers use-after-free. llvm-svn: 359055
Diffstat (limited to 'llvm/lib/Analysis/AliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/AliasAnalysis.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 4bb3b80511a..06a33f659c1 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -79,10 +79,12 @@ AAResults::~AAResults() {
bool AAResults::invalidate(Function &F, const PreservedAnalyses &PA,
FunctionAnalysisManager::Invalidator &Inv) {
- // 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. However, we still need to check if any of the dependencies end
- // up being invalidated, and invalidate ourselves in that case.
+ // Check if the AA manager itself has been invalidated.
+ auto PAC = PA.getChecker<AAManager>();
+ if (!PAC.preserved() && !PAC.preservedSet<AllAnalysesOn<Function>>())
+ return true; // The manager needs to be blown away, clear everything.
+
+ // Check all of the dependencies registered.
for (AnalysisKey *ID : AADeps)
if (Inv.invalidate(ID, F, PA))
return true;
OpenPOWER on IntegriCloud