[PATCH] D151380: [ModuleInliner] Try moving function-simplification before module inliner

Mingming Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 31 18:59:30 PDT 2023


mingmingl updated this revision to Diff 527260.
mingmingl retitled this revision from "[ModuleInliner] Add two cgscc pass in module-inliner pipeline for simplication parity." to "[ModuleInliner] Try moving function-simplification before module inliner".
mingmingl edited the summary of this revision.
mingmingl added a comment.

Turns out the improvement I saw is an artifact of testing flow (in a/b or b/a,  test is always worse than base for a reason when I enable new changes in baseline). Thanks for the offline discussions!

Plan to move function-simplication before module inliner and see how it works out.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151380/new/

https://reviews.llvm.org/D151380

Files:
  llvm/lib/Passes/PassBuilderPipelines.cpp


Index: llvm/lib/Passes/PassBuilderPipelines.cpp
===================================================================
--- llvm/lib/Passes/PassBuilderPipelines.cpp
+++ llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -948,12 +948,22 @@
   // inline deferral logic in module inliner.
   IP.EnableDeferral = false;
 
-  MPM.addPass(ModuleInlinerPass(IP, UseInlineAdvisor, Phase));
+  MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(
+      PostOrderFunctionAttrsPass(/*SkipNonRecursive*/ true)));
+
+  if (Level == OptimizationLevel::O3)
+    MPM.addPass(
+        createModuleToPostOrderCGSCCPassAdaptor(ArgumentPromotionPass()));
 
   MPM.addPass(createModuleToFunctionPassAdaptor(
       buildFunctionSimplificationPipeline(Level, Phase),
       PTO.EagerlyInvalidateAnalyses));
 
+  MPM.addPass(ModuleInlinerPass(IP, UseInlineAdvisor, Phase));
+
+  MPM.addPass(
+      createModuleToPostOrderCGSCCPassAdaptor(PostOrderFunctionAttrsPass()));
+
   MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(
       CoroSplitPass(Level != OptimizationLevel::O0)));
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151380.527260.patch
Type: text/x-patch
Size: 1055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230601/23c0d7a8/attachment.bin>


More information about the llvm-commits mailing list