diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -350,6 +350,9 @@ // before... FPM.addPass(SCCPPass()); + if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink) + FPM.addPass(LowerConstantIntrinsicsPass()); + // Delete dead bit computations (instcombine runs after to fold away the dead // computations, and then ADCE will run later to exploit any new DCE // opportunities that creates). @@ -557,6 +560,9 @@ // TODO: Investigate if this is too expensive. FPM.addPass(ADCEPass()); + if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink) + FPM.addPass(LowerConstantIntrinsicsPass()); + // Specially optimize memory movement as it doesn't look like dataflow in SSA. FPM.addPass(MemCpyOptPass()); @@ -1127,7 +1133,6 @@ FunctionPassManager OptimizePM; OptimizePM.addPass(Float2IntPass()); - OptimizePM.addPass(LowerConstantIntrinsicsPass()); if (EnableMatrix) { OptimizePM.addPass(LowerMatrixIntrinsicsPass()); diff --git a/llvm/test/Other/new-pm-defaults.ll b/llvm/test/Other/new-pm-defaults.ll --- a/llvm/test/Other/new-pm-defaults.ll +++ b/llvm/test/Other/new-pm-defaults.ll @@ -177,6 +177,7 @@ ; CHECK-O23SZ-NEXT: Running analysis: PhiValuesAnalysis ; CHECK-O1-NEXT: Running pass: MemCpyOptPass ; CHECK-O-NEXT: Running pass: SCCPPass +; CHECK-O1-NEXT: Running pass: LowerConstantIntrinsicsPass on foo ; CHECK-O-NEXT: Running pass: BDCEPass ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis ; CHECK-O-NEXT: Running pass: InstCombinePass @@ -188,6 +189,7 @@ ; CHECK-O1-NEXT: Running pass: CoroElidePass ; CHECK-O-NEXT: Running pass: ADCEPass ; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis +; CHECK-O23SZ-NEXT: Running pass: LowerConstantIntrinsicsPass on foo ; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass ; CHECK-O23SZ-NEXT: Running pass: DSEPass ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass @@ -207,7 +209,6 @@ ; CHECK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA ; CHECK-O-NEXT: Running pass: Float2IntPass -; CHECK-O-NEXT: Running pass: LowerConstantIntrinsicsPass on foo ; CHECK-MATRIX: Running pass: LowerMatrixIntrinsicsPass on f ; CHECK-MATRIX-NEXT: Running pass: EarlyCSEPass on f ; CHECK-EP-VECTORIZER-START-NEXT: Running pass: NoOpFunctionPass diff --git a/llvm/test/Other/new-pm-thinlto-defaults.ll b/llvm/test/Other/new-pm-thinlto-defaults.ll --- a/llvm/test/Other/new-pm-thinlto-defaults.ll +++ b/llvm/test/Other/new-pm-thinlto-defaults.ll @@ -30,7 +30,7 @@ ; Postlink pipelines: ; RUN: opt -disable-verify -verify-cfg-preserved=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \ ; RUN: -passes='thinlto' -S %s 2>&1 \ -; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1,CHECK-POSTLINK-O,%llvmcheckext +; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1,CHECK-POSTLINK-O,CHECK-POSTLINK-O1,%llvmcheckext ; RUN: opt -disable-verify -verify-cfg-preserved=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-POSTLINK-O,%llvmcheckext,CHECK-POSTLINK-O2 @@ -42,7 +42,7 @@ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Os,CHECK-O23SZ,CHECK-POSTLINK-O,%llvmcheckext,CHECK-POSTLINK-Os ; RUN: opt -disable-verify -verify-cfg-preserved=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \ ; RUN: -passes='thinlto' -S %s 2>&1 \ -; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Oz,CHECK-O23SZ,CHECK-POSTLINK-O,%llvmcheckext +; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Oz,CHECK-O23SZ,CHECK-POSTLINK-O,CHECK-POSTLINK-Oz,%llvmcheckext ; RUN: opt -disable-verify -verify-cfg-preserved=0 -eagerly-invalidate-analyses=0 -debug-pass-manager -new-pm-debug-info-for-profiling \ ; RUN: -passes='thinlto' -S %s 2>&1 \ ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-POSTLINK-O,%llvmcheckext,CHECK-POSTLINK-O2 @@ -164,6 +164,7 @@ ; CHECK-O3-NEXT: Running analysis: PhiValuesAnalysis ; CHECK-O1-NEXT: Running pass: MemCpyOptPass ; CHECK-O-NEXT: Running pass: SCCPPass +; CHECK-POSTLINK-O1-NEXT: Running pass: LowerConstantIntrinsicsPass ; CHECK-O-NEXT: Running pass: BDCEPass ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis ; CHECK-O-NEXT: Running pass: InstCombinePass @@ -174,6 +175,10 @@ ; CHECK-O1-NEXT: Running pass: CoroElidePass ; CHECK-O-NEXT: Running pass: ADCEPass ; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis +; CHECK-POSTLINK-O2-NEXT: Running pass: LowerConstantIntrinsicsPass +; CHECK-POSTLINK-O3-NEXT: Running pass: LowerConstantIntrinsicsPass +; CHECK-POSTLINK-Os-NEXT: Running pass: LowerConstantIntrinsicsPass +; CHECK-POSTLINK-Oz-NEXT: Running pass: LowerConstantIntrinsicsPass ; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass ; CHECK-O23SZ-NEXT: Running pass: DSEPass ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass @@ -191,7 +196,6 @@ ; CHECK-POSTLINK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass ; CHECK-POSTLINK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA ; CHECK-POSTLINK-O-NEXT: Running pass: Float2IntPass -; CHECK-POSTLINK-O-NEXT: Running pass: LowerConstantIntrinsicsPass ; CHECK-EXT: Running pass: {{.*}}::Bye ; CHECK-POSTLINK-O-NEXT: Running pass: LoopSimplifyPass ; CHECK-POSTLINK-O-NEXT: Running pass: LCSSAPass diff --git a/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll b/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll --- a/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll +++ b/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll @@ -137,6 +137,7 @@ ; CHECK-O3-NEXT: Running analysis: PhiValuesAnalysis ; CHECK-O1-NEXT: Running pass: MemCpyOptPass ; CHECK-O-NEXT: Running pass: SCCPPass +; CHECK-O1-NEXT: Running pass: LowerConstantIntrinsicsPass ; CHECK-O-NEXT: Running pass: BDCEPass ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis ; CHECK-O-NEXT: Running pass: InstCombinePass @@ -146,6 +147,7 @@ ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis ; CHECK-O1-NEXT: Running pass: CoroElidePass ; CHECK-O-NEXT: Running pass: ADCEPass +; CHECK-O23SZ-NEXT: Running pass: LowerConstantIntrinsicsPass ; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass ; CHECK-O23SZ-NEXT: Running pass: DSEPass ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass @@ -162,7 +164,6 @@ ; CHECK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA ; CHECK-O-NEXT: Running pass: Float2IntPass -; CHECK-O-NEXT: Running pass: LowerConstantIntrinsicsPass ; CHECK-EXT: Running pass: {{.*}}::Bye ; CHECK-O-NEXT: Running pass: LoopSimplifyPass on foo ; CHECK-O-NEXT: Running pass: LCSSAPass on foo diff --git a/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll b/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll --- a/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll +++ b/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll @@ -146,6 +146,7 @@ ; CHECK-O3-NEXT: Running analysis: PhiValuesAnalysis ; CHECK-O1-NEXT: Running pass: MemCpyOptPass ; CHECK-O-NEXT: Running pass: SCCPPass +; CHECK-O1-NEXT: Running pass: LowerConstantIntrinsicsPass ; CHECK-O-NEXT: Running pass: BDCEPass ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis ; CHECK-O-NEXT: Running pass: InstCombinePass @@ -155,6 +156,7 @@ ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis ; CHECK-O1-NEXT: Running pass: CoroElidePass ; CHECK-O-NEXT: Running pass: ADCEPass +; CHECK-O23SZ-NEXT: Running pass: LowerConstantIntrinsicsPass ; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass ; CHECK-O23SZ-NEXT: Running pass: DSEPass ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass @@ -174,7 +176,6 @@ ; CHECK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA ; CHECK-O-NEXT: Running pass: Float2IntPass -; CHECK-O-NEXT: Running pass: LowerConstantIntrinsicsPass ; CHECK-EXT: Running pass: {{.*}}::Bye ; CHECK-O-NEXT: Running pass: LoopSimplifyPass ; CHECK-O-NEXT: Running pass: LCSSAPass