[llvm] [LV] Allow scalable epilogue VFs matching the MainLoop VF (PR #208686)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 03:14:59 PDT 2026


================
@@ -3592,14 +3592,11 @@ std::unique_ptr<VPlan> LoopVectorizationPlanner::selectBestEpiloguePlan(
 
     VPlan &CurrentPlan = getPlanFor(NextVF.Width);
     ElementCount EffectiveVF = GetEffectiveVF(CurrentPlan, NextVF.Width);
-    // Skip candidate VFs with widths >= the (estimated) runtime VF (scalable
-    // vectors) or > the VF of the main loop (fixed vectors).
+    // Skip fixed vector VFs > to the estimated runtime VF, or any VF > than
+    // the VF of the main loop.
     if ((!EffectiveVF.isScalable() && MainLoopVF.isScalable() &&
-         ElementCount::isKnownGE(EffectiveVF, EstimatedRuntimeVF)) ||
-        (EffectiveVF.isScalable() &&
-         ElementCount::isKnownGE(EffectiveVF, MainLoopVF)) ||
-        (!EffectiveVF.isScalable() && !MainLoopVF.isScalable() &&
-         ElementCount::isKnownGT(EffectiveVF, MainLoopVF)))
+         ElementCount::isKnownGT(EffectiveVF, EstimatedRuntimeVF)) ||
+        ElementCount::isKnownGT(EffectiveVF, MainLoopVF))
----------------
MacDue wrote:

I don't think that works in all cases, as the first section only applies if `!EffectiveVF.isScalable()`. 

For example, if `EffectiveVF` is `vscale x 2` and `MainLoopVF` is `vscale x 1` and for some target `vscaleForTuning` is 4. 

`vscale x 2` is > `vscale x 1`, but `vscale x 2` is not known greater than 4 (`EstimatedRuntimeVF`).


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


More information about the llvm-commits mailing list