llvm-toolchain/debian/patches/fix-merge-MergeFunctions-scheduling.diff
2022-05-30 21:51:18 +02:00

53 lines
2.3 KiB
Diff

Index: llvm-toolchain-13-13.0.1/llvm/lib/Passes/PassBuilder.cpp
===================================================================
--- llvm-toolchain-13-13.0.1.orig/llvm/lib/Passes/PassBuilder.cpp
+++ llvm-toolchain-13-13.0.1/llvm/lib/Passes/PassBuilder.cpp
@@ -1416,23 +1416,6 @@ PassBuilder::buildModuleOptimizationPipe
addVectorPasses(Level, OptimizePM, /* IsFullLTO */ false);
- // Split out cold code. Splitting is done late to avoid hiding context from
- // other optimizations and inadvertently regressing performance. The tradeoff
- // is that this has a higher code size cost than splitting early.
- if (EnableHotColdSplit && !LTOPreLink)
- MPM.addPass(HotColdSplittingPass());
-
- // Search the code for similar regions of code. If enough similar regions can
- // be found where extracting the regions into their own function will decrease
- // the size of the program, we extract the regions, a deduplicate the
- // structurally similar regions.
- if (EnableIROutliner)
- MPM.addPass(IROutlinerPass());
-
- // Merge functions if requested.
- if (PTO.MergeFunctions)
- MPM.addPass(MergeFunctionsPass());
-
// LoopSink pass sinks instructions hoisted by LICM, which serves as a
// canonicalization pass that enables other optimizations. As a result,
// LoopSink pass needs to be a very late IR pass to avoid undoing LICM
@@ -1459,6 +1442,23 @@ PassBuilder::buildModuleOptimizationPipe
for (auto &C : OptimizerLastEPCallbacks)
C(MPM, Level);
+ // Split out cold code. Splitting is done late to avoid hiding context from
+ // other optimizations and inadvertently regressing performance. The tradeoff
+ // is that this has a higher code size cost than splitting early.
+ if (EnableHotColdSplit && !LTOPreLink)
+ MPM.addPass(HotColdSplittingPass());
+
+ // Search the code for similar regions of code. If enough similar regions can
+ // be found where extracting the regions into their own function will decrease
+ // the size of the program, we extract the regions, a deduplicate the
+ // structurally similar regions.
+ if (EnableIROutliner)
+ MPM.addPass(IROutlinerPass());
+
+ // Merge functions if requested.
+ if (PTO.MergeFunctions)
+ MPM.addPass(MergeFunctionsPass());
+
if (PTO.CallGraphProfile)
MPM.addPass(CGProfilePass());