diff options
Diffstat (limited to 'llvm/lib/Passes/PassBuilder.cpp')
-rw-r--r-- | llvm/lib/Passes/PassBuilder.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 249dab50986..045c8541c0d 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -658,6 +658,14 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, // globals. MPM.addPass(DeadArgumentEliminationPass()); + // Split out cold code. Splitting is done before inlining because 1) the most + // common kinds of cold regions can (a) be found before inlining and (b) do + // not grow after inlining, and 2) inhibiting inlining of cold code improves + // code size & compile time. Split after Mem2Reg to make code model estimates + // more accurate, but before InstCombine to allow it to clean things up. + if (EnableHotColdSplit && Phase != ThinLTOPhase::PostLink) + MPM.addPass(HotColdSplittingPass()); + // Create a small function pass pipeline to cleanup after all the global // optimizations. FunctionPassManager GlobalCleanupPM(DebugLogging); @@ -723,11 +731,6 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, MainCGPipeline.addPass(createCGSCCToFunctionPassAdaptor( buildFunctionSimplificationPipeline(Level, Phase, DebugLogging))); - // We only want to do hot cold splitting once for ThinLTO, during the - // post-link ThinLTO. - if (EnableHotColdSplit && Phase != ThinLTOPhase::PreLink) - MPM.addPass(HotColdSplittingPass()); - for (auto &C : CGSCCOptimizerLateEPCallbacks) C(MainCGPipeline, Level); |