[llvm] [LV] codegen for tail-folded epilogue loop (PR #208764)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 23:17:26 PDT 2026


================
@@ -8107,6 +8253,20 @@ bool LoopVectorizePass::processLoop(Loop *L) {
 
   // Plan how to best vectorize.
   LVP.plan(UserVF, UserIC);
+  if (EpilogueTailFoldingCM) {
+    // Enable the epilogue tail-folding CM
+    LVP.enableEpilogueTFCM();
+    if (!LVP.planForEpilogueTF()) {
----------------
fhahn wrote:

Is there a reason to call this here, instead of where we handle forced epilogue VF in `::plan`? Then `plainForEpilogueTF` could be called before creating the non-tail-folded epilogue plan, if it fails, we continue constructing the non-tail-folded epilogue plan.

I think that would make it independent of the order the plans are constructed as well, which got adjusted in https://github.com/llvm/llvm-project/pull/214379

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


More information about the llvm-commits mailing list