[llvm] [LV] Add -predicated-epilogue option for tail-folded epilogue (PR #190697)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 17 02:10:29 PDT 2026
================
@@ -8298,6 +8315,47 @@ getEpilogueLowering(Function *F, Loop *L, LoopVectorizeHints &Hints,
return CM_EpilogueAllowed;
}
+/// Check if we can apply tail folding to the vectorized epilogue loop,
+/// enabling an unpredicated main vector loop with a tail-folded epilogue
+/// vector loop.
+static bool isEpilogueTailFoldingAllowed(const LoopVectorizationCostModel &CM,
----------------
david-arm wrote:
I'd like to think about this a bit more if that's ok? Ideally the negative cases would be handled by existing routines such as `computeMaxVF`, etc. where we bail out in cases where we can't perform tail-folding. I feel like at the place where this is called in `LoopVectorizePass::processLoop` we should have already rejected any obvious 'bad' or illegal cases and we should simply be saying something like "Tail-folded vector epilogues not supported yet".
I guess at the moment that's difficult to do because we're not actually attempting to create a LoopVectorizationCostModel for the tail-folded plans and so we're only calling computeMaxVF, etc for the non-tail-folded vplan.
https://github.com/llvm/llvm-project/pull/190697
More information about the llvm-commits
mailing list