[llvm] [LV] Add -predicated-epilogue option for tail-folded epilogue (PR #190697)

Hassnaa Hamdi via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 03:00:34 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,
----------------
hassnaaHamdi wrote:

I thought about having this function to avoid doing unnecessary work. Why the code creates extra CM instance  and do all the work needed to have tail-folding, and after that we find out tail-folding is not supported or the can't be supported for specific case. I think it's better to bailout as early as possible.

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


More information about the llvm-commits mailing list