mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[NewPM][LVI] Abandon LVI after CVP
As mentioned on D70376, LVI can currently cause performance issues when running under NewPM. The problem is that, unlike the legacy pass manager, NewPM will not immediately discard the LVI analysis if the following pass does not need it. This is a problem, because LVI has a high memory requirement, and mass invalidation of LVI values is very inefficient. LVI should only be alive during passes that actively interact with it. This patch addresses the issue by explicitly abandoning LVI after CVP, which gets us back to the LegacyPM behavior. Differential Revision: https://reviews.llvm.org/D84959
This commit is contained in:
parent
ad26adfc58
commit
ae08f299bd
@ -973,11 +973,19 @@ CorrelatedValuePropagationPass::run(Function &F, FunctionAnalysisManager &AM) {
|
||||
|
||||
bool Changed = runImpl(F, LVI, DT, getBestSimplifyQuery(AM, F));
|
||||
|
||||
if (!Changed)
|
||||
return PreservedAnalyses::all();
|
||||
PreservedAnalyses PA;
|
||||
PA.preserve<GlobalsAA>();
|
||||
PA.preserve<DominatorTreeAnalysis>();
|
||||
PA.preserve<LazyValueAnalysis>();
|
||||
if (!Changed) {
|
||||
PA = PreservedAnalyses::all();
|
||||
} else {
|
||||
PA.preserve<GlobalsAA>();
|
||||
PA.preserve<DominatorTreeAnalysis>();
|
||||
PA.preserve<LazyValueAnalysis>();
|
||||
}
|
||||
|
||||
// Keeping LVI alive is expensive, both because it uses a lot of memory, and
|
||||
// because invalidating values in LVI is expensive. While CVP does preserve
|
||||
// LVI, we know that passes after JumpThreading+CVP will not need the result
|
||||
// of this analysis, so we forcefully discard it early.
|
||||
PA.abandon<LazyValueAnalysis>();
|
||||
return PA;
|
||||
}
|
||||
|
@ -147,6 +147,7 @@
|
||||
; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
|
||||
; CHECK-O-NEXT: Running pass: SimplifyCFGPass
|
||||
; CHECK-O3-NEXT: AggressiveInstCombinePass
|
||||
; CHECK-O-NEXT: Running pass: InstCombinePass
|
||||
@ -200,7 +201,9 @@
|
||||
; CHECK-O-NEXT: Running pass: InstCombinePass
|
||||
; CHECK-EP-PEEPHOLE-NEXT: Running pass: NoOpFunctionPass
|
||||
; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: DSEPass
|
||||
; CHECK-O23SZ-NEXT: Starting llvm::Function pass manager run.
|
||||
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
|
||||
|
@ -112,6 +112,7 @@
|
||||
; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
|
||||
; CHECK-O-NEXT: Running pass: SimplifyCFGPass
|
||||
; CHECK-O3-NEXT: Running pass: AggressiveInstCombinePass
|
||||
; CHECK-O-NEXT: Running pass: InstCombinePass
|
||||
@ -173,7 +174,9 @@
|
||||
; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
|
||||
; CHECK-O-NEXT: Running pass: InstCombinePass
|
||||
; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: DSEPass
|
||||
; CHECK-O23SZ-NEXT: Starting llvm::Function pass manager run
|
||||
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
|
||||
|
@ -86,6 +86,7 @@
|
||||
; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
|
||||
; CHECK-O-NEXT: Running pass: SimplifyCFGPass
|
||||
; CHECK-O3-NEXT: Running pass: AggressiveInstCombinePass
|
||||
; CHECK-O-NEXT: Running pass: InstCombinePass
|
||||
@ -146,7 +147,9 @@
|
||||
; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
|
||||
; CHECK-O-NEXT: Running pass: InstCombinePass
|
||||
; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: DSEPass
|
||||
; CHECK-O23SZ-NEXT: Starting {{.*}}Function pass manager run
|
||||
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
|
||||
|
@ -94,6 +94,7 @@
|
||||
; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
|
||||
; CHECK-O-NEXT: Running pass: SimplifyCFGPass
|
||||
; CHECK-O3-NEXT: Running pass: AggressiveInstCombinePass
|
||||
; CHECK-O-NEXT: Running pass: InstCombinePass
|
||||
@ -154,7 +155,9 @@
|
||||
; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
|
||||
; CHECK-O-NEXT: Running pass: InstCombinePass
|
||||
; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: DSEPass
|
||||
; CHECK-O23SZ-NEXT: Starting {{.*}}Function pass manager run
|
||||
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
|
||||
|
@ -127,6 +127,7 @@
|
||||
; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
|
||||
; CHECK-O-NEXT: Running pass: SimplifyCFGPass
|
||||
; CHECK-O3-NEXT: Running pass: AggressiveInstCombinePass
|
||||
; CHECK-O-NEXT: Running pass: InstCombinePass
|
||||
@ -196,7 +197,9 @@
|
||||
; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
|
||||
; CHECK-O-NEXT: Running pass: InstCombinePass
|
||||
; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: DSEPass
|
||||
; CHECK-O23SZ-NEXT: Starting {{.*}}Function pass manager run
|
||||
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
|
||||
@ -213,10 +216,26 @@
|
||||
; CHECK-O-NEXT: Finished CGSCC pass manager run.
|
||||
; CHECK-O-NEXT: Finished {{.*}}Module pass manager run.
|
||||
; CHECK-O-NEXT: Finished {{.*}}Module pass manager run.
|
||||
; CHECK-O23SZ-NEXT: Clearing all analysis results for: <possibly invalidated loop>
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: DominatorTreeAnalysis
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: MemorySSAAnalysis
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: LoopAnalysis
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: PostDominatorTreeAnalysis
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: BranchProbabilityAnalysis
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: BlockFrequencyAnalysis
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: InnerAnalysisManagerProxy
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: PhiValuesAnalysis
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: MemoryDependenceAnalysis
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: DemandedBitsAnalysis
|
||||
; CHECK-O3-NEXT: Invalidating analysis: DominanceFrontierAnalysis
|
||||
; CHECK-O3-NEXT: Invalidating analysis: RegionInfoAnalysis
|
||||
; CHECK-O23SZ-NEXT: Clearing all analysis results for: foo
|
||||
; CHECK-O-NEXT: Running pass: GlobalOptPass
|
||||
; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis on bar
|
||||
; CHECK-EXT: Running pass: {{.*}}::Bye
|
||||
; CHECK-O-NEXT: Finished {{.*}}Module pass manager run.
|
||||
; CHECK-O23SZ-NEXT: Clearing all analysis results for: foo
|
||||
; CHECK-O-NEXT: Running pass: NameAnonGlobalPass
|
||||
; CHECK-O-NEXT: Running pass: PrintModulePass
|
||||
|
||||
|
@ -93,6 +93,7 @@
|
||||
; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
|
||||
; CHECK-O-NEXT: Running pass: SimplifyCFGPass
|
||||
; CHECK-O3-NEXT: Running pass: AggressiveInstCombinePass
|
||||
; CHECK-O-NEXT: Running pass: InstCombinePass
|
||||
@ -152,7 +153,9 @@
|
||||
; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
|
||||
; CHECK-O-NEXT: Running pass: InstCombinePass
|
||||
; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
|
||||
; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
|
||||
; CHECK-O23SZ-NEXT: Running pass: DSEPass
|
||||
; CHECK-O23SZ-NEXT: Starting {{.*}}Function pass manager run
|
||||
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
|
||||
|
Loading…
Reference in New Issue
Block a user