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

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 03:42:11 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:

That's ok and I have moved LoopVersioningLICM into OptimizePM, and LoopVersioningLICM and LICM pass use  each FunctionToLoopPassAdaptor  with different parameters.

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


More information about the llvm-commits mailing list