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 @@ -1186,6 +1186,9 @@ PGOOpt->ProfileRemappingFile, LTOPhase); } + for (auto &C : OptimizerEarlyEPCallbacks) + C(MPM, Level); + // Re-compute GlobalsAA here prior to function passes. This is particularly // useful as the above will have inlined, DCE'ed, and function-attr // propagated everything. We should at this point have a reasonably minimal @@ -1195,9 +1198,6 @@ // memory operations. MPM.addPass(RecomputeGlobalsAAPass()); - for (auto &C : OptimizerEarlyEPCallbacks) - C(MPM, Level); - FunctionPassManager OptimizePM; OptimizePM.addPass(Float2IntPass()); OptimizePM.addPass(LowerConstantIntrinsicsPass()); 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 @@ -225,8 +225,8 @@ ; CHECK-DEFAULT-NEXT: Running pass: EliminateAvailableExternallyPass ; CHECK-LTO-NOT: Running pass: EliminateAvailableExternallyPass ; CHECK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass -; CHECK-O-NEXT: Running pass: RecomputeGlobalsAAPass ; CHECK-EP-OPTIMIZER-EARLY: Running pass: NoOpModulePass +; CHECK-O-NEXT: Running pass: RecomputeGlobalsAAPass ; CHECK-O-NEXT: Running pass: Float2IntPass ; CHECK-O-NEXT: Running pass: LowerConstantIntrinsicsPass on foo ; CHECK-MATRIX: Running pass: LowerMatrixIntrinsicsPass on f 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 @@ -206,8 +206,8 @@ ; CHECK-POSTLINK-O-NEXT: Running pass: GlobalDCEPass ; CHECK-POSTLINK-O-NEXT: Running pass: EliminateAvailableExternallyPass ; CHECK-POSTLINK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass -; CHECK-POSTLINK-O-NEXT: Running pass: RecomputeGlobalsAAPass ; CHECK-POST-EP-OPT-EARLY-NEXT: Running pass: NoOpModulePass +; CHECK-POSTLINK-O-NEXT: Running pass: RecomputeGlobalsAAPass ; CHECK-POSTLINK-O-NEXT: Running pass: Float2IntPass ; CHECK-POSTLINK-O-NEXT: Running pass: LowerConstantIntrinsicsPass ; CHECK-EXT: Running pass: {{.*}}::Bye