1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[AliasAnalysis] AAResults preserves AAManager.

Summary:
AAResults should not invalidate AAManager.
Update tests.

Reviewers: chandlerc

Subscribers: mehdi_amini, jlebar, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60914

llvm-svn: 359014
This commit is contained in:
Alina Sbirlea 2019-04-23 17:21:18 +00:00
parent 2b697e981f
commit b8b7574fee
5 changed files with 13 additions and 13 deletions

View File

@ -1096,6 +1096,12 @@ bool isIdentifiedFunctionLocal(const Value *V);
/// This manager effectively wraps the AnalysisManager for registering alias
/// analyses. When you register your alias analysis with this manager, it will
/// ensure the analysis itself is registered with its AnalysisManager.
///
/// The result of this analysis is only invalidated if one of the particular
/// aggregated AA results end up being invalidated. This removes the need to
/// explicitly preserve the results of `AAManager`. Note that analyses should no
/// longer be registered once the `AAManager` is run.
class AAManager : public AnalysisInfoMixin<AAManager> {
public:
using Result = AAResults;

View File

@ -79,12 +79,10 @@ AAResults::~AAResults() {
bool AAResults::invalidate(Function &F, const PreservedAnalyses &PA,
FunctionAnalysisManager::Invalidator &Inv) {
// 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.
// 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.
for (AnalysisKey *ID : AADeps)
if (Inv.invalidate(ID, F, PA))
return true;

View File

@ -1,17 +1,16 @@
; Test that memdep gets invalidated when the analyses it depends on are
; invalidated.
;
; Check AA specifically.
; Check AA. AA is stateless, there's nothing to invalidate.
; RUN: opt -disable-output -debug-pass-manager -aa-pipeline='basic-aa' %s 2>&1 \
; RUN: -passes='require<memdep>,invalidate<aa>,gvn' \
; RUN: | FileCheck %s --check-prefix=CHECK-AA-INVALIDATE
; CHECK-AA-INVALIDATE: Running pass: RequireAnalysisPass
; CHECK-AA-INVALIDATE: Running analysis: MemoryDependenceAnalysis
; CHECK-AA-INVALIDATE: Running pass: InvalidateAnalysisPass
; CHECK-AA-INVALIDATE: Invalidating analysis: AAManager
; CHECK-AA-INVALIDATE: Invalidating analysis: MemoryDependenceAnalysis
; CHECK-NOT-AA-INVALIDATE: Invalidating analysis: MemoryDependenceAnalysis
; CHECK-AA-INVALIDATE: Running pass: GVN
; CHECK-AA-INVALIDATE: Running analysis: MemoryDependenceAnalysis
; CHECK-NOT-AA-INVALIDATE: Running analysis: MemoryDependenceAnalysis
;
; Check domtree specifically.
; RUN: opt -disable-output -debug-pass-manager %s 2>&1 \

View File

@ -355,13 +355,11 @@
; CHECK-AA-MODULE-INVALIDATE: Running analysis: AAManager
; CHECK-AA-MODULE-INVALIDATE: Finished llvm::Function pass manager run
; CHECK-AA-MODULE-INVALIDATE: Running pass: InvalidateAnalysisPass
; CHECK-AA-MODULE-INVALIDATE: Invalidating analysis: AAManager
; CHECK-AA-MODULE-INVALIDATE: Invalidating analysis: GlobalsAA
; CHECK-AA-MODULE-INVALIDATE: Running pass: RequireAnalysisPass
; CHECK-AA-MODULE-INVALIDATE: Running analysis: GlobalsAA
; CHECK-AA-MODULE-INVALIDATE: Starting llvm::Function pass manager run
; CHECK-AA-MODULE-INVALIDATE: Running pass: AAEvaluator
; CHECK-AA-MODULE-INVALIDATE: Running analysis: AAManager
; CHECK-AA-MODULE-INVALIDATE: Finished llvm::Function pass manager run
; CHECK-AA-MODULE-INVALIDATE: Finished llvm::Module pass manager run

View File

@ -572,7 +572,6 @@ TEST_F(LoopPassManagerTest, InvalidationOfBundledAnalyses) {
// invalidation and running.
EXPECT_CALL(MFPHandle, run(HasName("f"), _))
.WillOnce(Return(getLoopPassPreservedAnalyses()));
EXPECT_CALL(MLAHandle, invalidate(_, _, _)).Times(3);
EXPECT_CALL(MLAHandle, run(HasName("loop.0.0"), _, _));
EXPECT_CALL(MLAHandle, run(HasName("loop.0.1"), _, _));
EXPECT_CALL(MLAHandle, run(HasName("loop.0"), _, _));