[llvm] [PassBuilder] Add extra ModuleInliner/SROA/SimplifyCFG/LICM to late FullLTO passes (PR #197678)

Momchil Velikov via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 04:05:45 PDT 2026


================
@@ -2266,6 +2278,20 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
   // Add late LTO optimization passes.
   FunctionPassManager LateFPM;
 
+  LateFPM.addPass(SROAPass(SROAOptions::ModifyCFG));
+
+  // Delete basic blocks, which optimization passes may have killed.
+  LateFPM.addPass(SimplifyCFGPass(SimplifyCFGOptions()
+                                      .convertSwitchRangeToICmp(true)
+                                      .convertSwitchToArithmetic(true)
+                                      .hoistCommonInsts(true)
+                                      .speculateUnpredictables(true)));
+
----------------
momchil-velikov wrote:

This part of the patch (SimplifyCFG -> LICM -> CSE(GVN or EarlyCSE)) was added to recover about 1% regression in x264. CSE was later removed because overall it wasn't advantageous (improved some benchmarks regressed some, GVN in particular regressed exchange by 19%).


https://github.com/llvm/llvm-project/pull/197678


More information about the llvm-commits mailing list