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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 03:32:56 PDT 2026


================
@@ -5580,12 +5584,78 @@ void LoopVectorizationPlanner::plan(ElementCount UserVF, unsigned UserIC) {
     CM.collectNonVectorizedAndSetWideningDecisions(VF);
   }
 
-  buildVPlans(*VPlan1, ElementCount::getFixed(1), MaxFactors.FixedVF);
-  buildVPlans(*VPlan1, ElementCount::getScalable(1), MaxFactors.ScalableVF);
+  buildVPlans(*VPlan1, ElementCount::getFixed(1), MaxFactors.FixedVF, CM);
+  buildVPlans(*VPlan1, ElementCount::getScalable(1), MaxFactors.ScalableVF, CM);
 
   LLVM_DEBUG(printPlans(dbgs()));
 }
 
+bool LoopVectorizationPlanner::planForEpilogueTF(
+    ElementCount UserVF, unsigned UserIC, ElementCount EpilogueUserVF,
+    LoopVectorizationCostModel &EpilogueCM) {
+  if (VPlans.empty()) {
+    LLVM_DEBUG(dbgs() << "LV: no vplans have been built for main loop VF, bail "
+                         "out of epilogue tail-folding\n");
+    return false;
+  }
+  if (!OrigLoop->isInnermost())
----------------
david-arm wrote:

It would be good to have an error message and a test for this.

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


More information about the llvm-commits mailing list