[llvm] [LV] Add eligibility checks for epilogue tail-folding. (PR #217364)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 12:49:34 PDT 2026


================
@@ -7148,23 +7150,54 @@ getEpilogueTailLowering(const LoopVectorizationCostModel &MainCM, const Loop *L,
   if (!EnableEpilogueVectorization) {
     reportVectorizationInfo(
         "Options conflict, epilogue vectorization is disallowed while "
-        "epilogue tail-folding allowed!\n",
+        "epilogue tail-folding allowed!",
         "UnsupportedEpilogueTailFoldingPolicy", ORE, L);
     return CM_EpilogueAllowed;
   }
 
+  if (!Hints.getWidth() || !hasForcedEpilogueVF()) {
+    reportVectorizationInfo("For now, epilogue tail-folding can't be "
+                            "applied without forced main/epilogue loop VF",
+                            "UnsupportedEpilogueTailFoldingPolicy", ORE, L);
+    return CM_EpilogueAllowed;
+  }
+
+  if (ElementCount::isKnownLE(Hints.getWidth(), EpilogueVectorizationForceVF)) {
+    reportVectorizationInfo("For now, epilogue tail-folding can't be "
+                            "applied when mainVF <= epilogueVF",
----------------
fhahn wrote:

nit: might be clearer to spell out `mainVF` and `epilogueVF`, as remarks are also used by non-compiler developers
```suggestion
                            "applied when the VF of the main loop <= VF of the epilogue",
```

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


More information about the llvm-commits mailing list