[llvm] [LV] Add tests for excluded cases in epiloge tail-folding (PR #217364)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 07:01:14 PDT 2026
================
@@ -7148,23 +7150,55 @@ 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",
+ "UnsupportedEpilogueTailFoldingPolicy", ORE, L);
+ return CM_EpilogueAllowed;
+ }
+
+ if (!L->isInnermost()) {
+ reportVectorizationInfo(
+ "Epilogue tail-folding is not supported for outer loop",
+ "InvalidTailFoldedEpilogue", ORE, L);
+ return CM_EpilogueAllowed;
+ }
+
// If scalar epilogue is explicitly required, we can't apply TF.
if (MainCM.requiresScalarEpilogue(/*IsVectorizing*/ true)) {
- LLVM_DEBUG(dbgs() << "LV: Epilogue tail-folding can't be applied because "
- "scalar epilogue is required\n"
- "LV: Fall back to a normal epilogue\n");
+ reportVectorizationInfo(
+ "Epilogue tail-folding can't be applied because scalar epilogue is "
+ "required. Fall back to a normal epilogue",
+ "InvalidTailFoldedEpilogue", ORE, L);
return CM_EpilogueAllowed;
}
// If having epilogue is NOT allowed, then no epilogue to apply TF for.
if (!MainCM.isEpilogueAllowed()) {
- LLVM_DEBUG(dbgs() << "LV: No epilogue to apply tail-folding for.\n"
- "LV: Fall back to a normal epilogue\n");
+ reportVectorizationInfo(
+ "Not applying tail-folding to the epilogue, since tail-folding is "
+ "already requested for the main vector loop.",
----------------
fhahn wrote:
I think there are some reasons no epilogue is allowed other than `CM_EpilogueNotNeededFoldTail`, which are unrelated to tail-folding (like ` CM_EpilogueNotAllowedOptSize` and `CM_EpilogueNotAllowedLowTripLoop`)
Maybe it would be worth to keep the wording closer to the original `no epilogue allowed`?
https://github.com/llvm/llvm-project/pull/217364
More information about the llvm-commits
mailing list