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

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 18:21:07 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:

My point is that LoopVersioningLICM pass is better to be as early as possible to reuse the following optimizations because the copy codes will be added no alias metadata. and it can be with LICM pass together certainly, what's your opinion about it? thanks

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


More information about the llvm-commits mailing list