[llvm] [VPlan] Unify inner and outer loop paths (NFCI). (PR #192868)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 03:36:14 PDT 2026


================
@@ -8423,19 +8326,28 @@ bool LoopVectorizePass::processLoop(Loop *L) {
   // Get user vectorization factor and interleave count.
   ElementCount UserVF = Hints.getWidth();
   unsigned UserIC = Hints.getInterleave();
-  if (UserIC > 1 && !LVL.isSafeForAnyVectorWidth())
+  // Outer loops don't have LoopAccessInfo, so skip the safety check and reset
+  // UserIC (interleaving is not supported for outer loops).
+  if (!IsInnerLoop)
+    UserIC = 0;
+  else if (UserIC > 1 && !LVL.isSafeForAnyVectorWidth())
     UserIC = 1;
 
   // Plan how to best vectorize.
   LVP.plan(UserVF, UserIC);
   auto [VF, BestPlanPtr] = LVP.computeBestVF();
   unsigned IC = 1;
 
-  if (ORE->allowExtraAnalysis(LV_NAME))
+  // For VPlan build stress testing of outer loops, bail after plan
+  // construction.
+  if (!IsInnerLoop && VPlanBuildStressTest)
----------------
fhahn wrote:

Unfortuantely given that `VPlanBuildStressTest` is an option, so I don't think there's a good way to set this at a single place.

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


More information about the llvm-commits mailing list