mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-21 01:06:46 +00:00
[PM] The assumption cache is fundamentally designed to be self-updating,
mark it as never invalidated in the new PM. The old PM already required this to work, and after a discussion with Hal this seems to really be the only sensible answer. The cache gracefully degrades as the IR is mutated, and most things which do this should already be incrementally updating the cache. This gets rid of a bunch of logic preserving and testing the invalidation of this analysis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292039 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
340ad683c8
commit
15050a4c1e
@ -84,6 +84,13 @@ public:
|
||||
/// its instructions.
|
||||
AssumptionCache(Function &F) : F(F), Scanned(false) {}
|
||||
|
||||
/// This cache is designed to be self-updating and so it should never be
|
||||
/// invalidated.
|
||||
bool invalidate(Function &, const PreservedAnalyses &,
|
||||
FunctionAnalysisManager::Invalidator &) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Add an @llvm.assume intrinsic to this function's cache.
|
||||
///
|
||||
/// The call passed in must be an instruction within this function and must
|
||||
|
@ -321,7 +321,6 @@ public:
|
||||
PA.preserveSet<AllAnalysesOn<Loop>>();
|
||||
PA.preserve<LoopAnalysisManagerFunctionProxy>();
|
||||
// We also preserve the set of standard analyses.
|
||||
PA.preserve<AssumptionAnalysis>();
|
||||
PA.preserve<DominatorTreeAnalysis>();
|
||||
PA.preserve<LoopAnalysis>();
|
||||
PA.preserve<ScalarEvolutionAnalysis>();
|
||||
|
@ -145,7 +145,6 @@ LoopAnalysisManagerFunctionProxy::run(Function &F,
|
||||
|
||||
PreservedAnalyses llvm::getLoopPassPreservedAnalyses() {
|
||||
PreservedAnalyses PA;
|
||||
PA.preserve<AssumptionAnalysis>();
|
||||
PA.preserve<DominatorTreeAnalysis>();
|
||||
PA.preserve<LoopAnalysis>();
|
||||
PA.preserve<LoopAnalysisManagerFunctionProxy>();
|
||||
|
@ -3179,7 +3179,6 @@ PreservedAnalyses InstCombinePass::run(Function &F,
|
||||
// FIXME: This should also 'preserve the CFG'.
|
||||
PreservedAnalyses PA;
|
||||
PA.preserve<AAManager>();
|
||||
PA.preserve<AssumptionAnalysis>();
|
||||
PA.preserve<DominatorTreeAnalysis>();
|
||||
PA.preserve<GlobalsAA>();
|
||||
return PA;
|
||||
|
@ -13,20 +13,6 @@
|
||||
; CHECK-AA-INVALIDATE: Running pass: GVN
|
||||
; CHECK-AA-INVALIDATE: Running analysis: MemoryDependenceAnalysis
|
||||
;
|
||||
; Check the assumptions analysis specifically.
|
||||
; FIXME: We don't have any test cases that actually fail if the assumption
|
||||
; cache becomes stale. This just tests what we believe to be correct.
|
||||
; RUN: opt -disable-output -debug-pass-manager %s 2>&1 \
|
||||
; RUN: -passes='require<memdep>,invalidate<assumptions>,gvn' \
|
||||
; RUN: | FileCheck %s --check-prefix=CHECK-ASSUMPTIONS-INVALIDATE
|
||||
; CHECK-ASSUMPTIONS-INVALIDATE: Running pass: RequireAnalysisPass
|
||||
; CHECK-ASSUMPTIONS-INVALIDATE: Running analysis: MemoryDependenceAnalysis
|
||||
; CHECK-ASSUMPTIONS-INVALIDATE: Running pass: InvalidateAnalysisPass
|
||||
; CHECK-ASSUMPTIONS-INVALIDATE: Invalidating analysis: AssumptionAnalysis
|
||||
; CHECK-ASSUMPTIONS-INVALIDATE: Invalidating analysis: MemoryDependenceAnalysis
|
||||
; CHECK-ASSUMPTIONS-INVALIDATE: Running pass: GVN
|
||||
; CHECK-ASSUMPTIONS-INVALIDATE: Running analysis: MemoryDependenceAnalysis
|
||||
;
|
||||
; Check domtree specifically.
|
||||
; RUN: opt -disable-output -debug-pass-manager %s 2>&1 \
|
||||
; RUN: -passes='require<memdep>,invalidate<domtree>,gvn' \
|
||||
|
@ -8,19 +8,6 @@
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; RUN: opt < %s -passes='require<scalar-evolution>,invalidate<assumptions>,print<scalar-evolution>' \
|
||||
; RUN: -debug-pass-manager -disable-output 2>&1 \
|
||||
; RUN: | FileCheck %s -check-prefixes=CHECK,CHECK-AC-INVALIDATE
|
||||
;
|
||||
; CHECK-AC-INVALIDATE: Running pass: RequireAnalysisPass
|
||||
; CHECK-AC-INVALIDATE: Running analysis: ScalarEvolutionAnalysis
|
||||
; CHECK-AC-INVALIDATE: Running analysis: AssumptionAnalysis
|
||||
; CHECK-AC-INVALIDATE: Running pass: InvalidateAnalysisPass
|
||||
; CHECK-AC-INVALIDATE: Invalidating analysis: AssumptionAnalysis
|
||||
; CHECK-AC-INVALIDATE: Running pass: ScalarEvolutionPrinterPass
|
||||
; CHECK-AC-INVALIDATE: Running analysis: ScalarEvolutionAnalysis
|
||||
; CHECK-AC-INVALIDATE: Running analysis: AssumptionAnalysis
|
||||
|
||||
; RUN: opt < %s -passes='require<scalar-evolution>,invalidate<domtree>,print<scalar-evolution>' \
|
||||
; RUN: -debug-pass-manager -disable-output 2>&1 \
|
||||
; RUN: | FileCheck %s -check-prefixes=CHECK,CHECK-DT-INVALIDATE
|
||||
|
@ -551,7 +551,6 @@ TEST_F(LoopPassManagerTest, InvalidationOfBundledAnalyses) {
|
||||
EXPECT_CALL(MFPHandle, run(HasName("f"), _)).WillOnce(InvokeWithoutArgs([] {
|
||||
auto PA = PreservedAnalyses::none();
|
||||
// Not preserving `AAManager`.
|
||||
PA.preserve<AssumptionAnalysis>();
|
||||
PA.preserve<DominatorTreeAnalysis>();
|
||||
PA.preserve<LoopAnalysis>();
|
||||
PA.preserve<LoopAnalysisManagerFunctionProxy>();
|
||||
@ -568,24 +567,6 @@ TEST_F(LoopPassManagerTest, InvalidationOfBundledAnalyses) {
|
||||
EXPECT_CALL(MFPHandle, run(HasName("f"), _)).WillOnce(InvokeWithoutArgs([] {
|
||||
auto PA = PreservedAnalyses::none();
|
||||
PA.preserve<AAManager>();
|
||||
// Not preserving `AssumptionAnalysis`.
|
||||
PA.preserve<DominatorTreeAnalysis>();
|
||||
PA.preserve<LoopAnalysis>();
|
||||
PA.preserve<LoopAnalysisManagerFunctionProxy>();
|
||||
PA.preserve<ScalarEvolutionAnalysis>();
|
||||
return PA;
|
||||
}));
|
||||
EXPECT_CALL(MLAHandle, run(HasName("loop.0.0"), _, _));
|
||||
EXPECT_CALL(MLAHandle, run(HasName("loop.0.1"), _, _));
|
||||
EXPECT_CALL(MLAHandle, run(HasName("loop.0"), _, _));
|
||||
FPM.addPass(MFPHandle.getPass());
|
||||
FPM.addPass(createFunctionToLoopPassAdaptor(
|
||||
RequireAnalysisLoopPass<MockLoopAnalysisHandle::Analysis>()));
|
||||
|
||||
EXPECT_CALL(MFPHandle, run(HasName("f"), _)).WillOnce(InvokeWithoutArgs([] {
|
||||
auto PA = PreservedAnalyses::none();
|
||||
PA.preserve<AAManager>();
|
||||
PA.preserve<AssumptionAnalysis>();
|
||||
// Not preserving `DominatorTreeAnalysis`.
|
||||
PA.preserve<LoopAnalysis>();
|
||||
PA.preserve<LoopAnalysisManagerFunctionProxy>();
|
||||
@ -602,7 +583,6 @@ TEST_F(LoopPassManagerTest, InvalidationOfBundledAnalyses) {
|
||||
EXPECT_CALL(MFPHandle, run(HasName("f"), _)).WillOnce(InvokeWithoutArgs([] {
|
||||
auto PA = PreservedAnalyses::none();
|
||||
PA.preserve<AAManager>();
|
||||
PA.preserve<AssumptionAnalysis>();
|
||||
PA.preserve<DominatorTreeAnalysis>();
|
||||
// Not preserving the `LoopAnalysis`.
|
||||
PA.preserve<LoopAnalysisManagerFunctionProxy>();
|
||||
@ -619,7 +599,6 @@ TEST_F(LoopPassManagerTest, InvalidationOfBundledAnalyses) {
|
||||
EXPECT_CALL(MFPHandle, run(HasName("f"), _)).WillOnce(InvokeWithoutArgs([] {
|
||||
auto PA = PreservedAnalyses::none();
|
||||
PA.preserve<AAManager>();
|
||||
PA.preserve<AssumptionAnalysis>();
|
||||
PA.preserve<DominatorTreeAnalysis>();
|
||||
PA.preserve<LoopAnalysis>();
|
||||
// Not preserving the `LoopAnalysisManagerFunctionProxy`.
|
||||
@ -636,7 +615,6 @@ TEST_F(LoopPassManagerTest, InvalidationOfBundledAnalyses) {
|
||||
EXPECT_CALL(MFPHandle, run(HasName("f"), _)).WillOnce(InvokeWithoutArgs([] {
|
||||
auto PA = PreservedAnalyses::none();
|
||||
PA.preserve<AAManager>();
|
||||
PA.preserve<AssumptionAnalysis>();
|
||||
PA.preserve<DominatorTreeAnalysis>();
|
||||
PA.preserve<LoopAnalysis>();
|
||||
PA.preserve<LoopAnalysisManagerFunctionProxy>();
|
||||
@ -654,7 +632,7 @@ TEST_F(LoopPassManagerTest, InvalidationOfBundledAnalyses) {
|
||||
// 'g' once with a requires pass and then run our mock pass over g a bunch
|
||||
// but just get cached results each time.
|
||||
EXPECT_CALL(MLAHandle, run(HasName("loop.g.0"), _, _));
|
||||
EXPECT_CALL(MFPHandle, run(HasName("g"), _)).Times(7);
|
||||
EXPECT_CALL(MFPHandle, run(HasName("g"), _)).Times(6);
|
||||
|
||||
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
|
||||
MPM.run(*M, MAM);
|
||||
|
Loading…
x
Reference in New Issue
Block a user