[llvm] Reland "[LTO] Run Argument Promotion before IPSCCP" (PR #111853)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 5 05:46:29 PST 2024


================
@@ -1828,6 +1828,15 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
     MPM.addPass(PGOIndirectCallPromotion(
         true /* InLTO */, PGOOpt && PGOOpt->Action == PGOOptions::SampleUse));
 
+    // Promoting by-reference arguments to by-value exposes more constants to
+    // IPSCCP.
+    MPM.addPass(
+        createModuleToPostOrderCGSCCPassAdaptor(PostOrderFunctionAttrsPass()));
+    MPM.addPass(
+        createModuleToPostOrderCGSCCPassAdaptor(ArgumentPromotionPass()));
+    MPM.addPass(
+        createModuleToFunctionPassAdaptor(SROAPass(SROAOptions::ModifyCFG)));
----------------
nikic wrote:

Sorry for not noting this before: Can we make all of these part of a single CGSCC pass manager? I don't think it makes sense to do a separate SCC iteration for FunctionAttrs and ArgPromo.

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


More information about the llvm-commits mailing list