[llvm] [LV] Add -fold-epilogue-tail option for tail-folded epilogue (PR #190697)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat May 2 03:17:43 PDT 2026
================
@@ -7559,6 +7583,44 @@ getEpilogueLowering(Function *F, Loop *L, LoopVectorizeHints &Hints,
return CM_EpilogueAllowed;
}
+/// Determine how to lower the epilogue for the vector epilogue loop.
+/// Check if there are any conflicts that prevent tail-folding the epilogue.
+/// \return CM_EpilogueNotNeededFoldEpilogueTail if epilogue tail-folding
+/// is possible, otherwise CM_EpilogueAllowed.
+static EpilogueLowering
+getEpilogueTailLowering(const LoopVectorizationCostModel &MainCM, const Loop *L,
+ OptimizationRemarkEmitter *ORE) {
+ // Epilogue TF is only enabled when explicitly requested via command line.
+ if (TailFoldingPolicy != TailFoldingPolicyTy::PreferFoldEpilogueTail)
+ return CM_EpilogueAllowed;
+
+ if (!EnableEpilogueVectorization) {
+ reportVectorizationInfo(
+ "LV: Options conflict, epilogue vectorization is disallowed while "
----------------
fhahn wrote:
I think `reportVectorizationInfo` will already add `LV:`. Might be good to have a test for the remark/debug output
```suggestion
"Options conflict, epilogue vectorization is disallowed while "
```
https://github.com/llvm/llvm-project/pull/190697
More information about the llvm-commits
mailing list