[llvm] [Passes] Add option for LoopVersioningLICM pass. (PR #67107)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 07:21:29 PDT 2023


================
@@ -1293,6 +1298,21 @@ PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
   if (RunPartialInlining)
     MPM.addPass(PartialInlinerPass());
 
+  // Scheduling LoopVersioningLICM when inlining is over, because after that
+  // we may see more accurate aliasing. Reason to run this late is that too
+  // early versioning may prevent further inlining due to increase of code
+  // size. By placing it just after inlining other optimizations which runs
+  // later might get benefit of no-alias assumption in clone loop.
+  if (UseLoopVersioningLICM) {
+    MPM.addPass(createModuleToFunctionPassAdaptor(
+        createFunctionToLoopPassAdaptor(LoopVersioningLICMPass())));
+    MPM.addPass(
+        createModuleToFunctionPassAdaptor(createFunctionToLoopPassAdaptor(
+            LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
+                     /*AllowSpeculation=*/true),
+            /*USeMemorySSA=*/true, /*UseBlockFrequencyInfo=*/false)));
+  }
----------------
lcvon007 wrote:

It's ok and I have moved it into the OptimizePM. Thanks for your advice.

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


More information about the llvm-commits mailing list