[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 03:26:04 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 don't think that's quite true because computeMaxVF also handles the ScalarEpilogueStatus. For example, if tail-folding is required it invalidates interleave groups, or if the trip count is known to be a multiple of all VFs it decides not to tail-fold. I do think that perhaps the name `computeMaxVF` is misleading because it's doing more than just calculating the Max VF. 

Alternatively, this logic could be moved into `LoopVectorizationPlanner::plan` where we call computeMaxVF.

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


More information about the llvm-commits mailing list