[llvm] [LV] Update forced epilogue VF options to allow different VFs than main. (PR #190393)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 10:00:19 PDT 2026


================
@@ -7152,10 +7167,19 @@ VectorizationFactor LoopVectorizationPlanner::computeBestVF() {
   if (VPlans.empty())
     return VectorizationFactor::Disabled();
   // If there is a single VPlan with a single VF, return it directly.
-  VPlan &FirstPlan = *VPlans[0];
-  if (VPlans.size() == 1 && size(FirstPlan.vectorFactors()) == 1)
-    return {*FirstPlan.vectorFactors().begin(), 0, 0};
+  if (VPlans.size() == 1 && size(VPlans[0]->vectorFactors()) == 1)
+    return {*VPlans[0]->vectorFactors().begin(), 0, 0};
 
+  ElementCount UserVF = Hints.getWidth();
+  if (EpilogueVectorizationForceVF > 1 && UserVF && hasPlanWithVF(UserVF)) {
+    [[maybe_unused]] ElementCount EpilogueVF =
+        ElementCount::getFixed(EpilogueVectorizationForceVF);
+    assert(*VPlans[0]->vectorFactors().begin() == EpilogueVF &&
+           "expected first plan to be for the forced epilogue VF");
+    return {UserVF, 0, 0};
----------------
fhahn wrote:

Yeah we can also assert for UserVF. It must be the single VF for the second plan. Updated now, as we also need to return the second plan now, thanks

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


More information about the llvm-commits mailing list