[llvm] [VPlan] Update getBestPlan to return VF, use also for epilogue vec. (PR #98821)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 21 06:45:23 PDT 2024


================
@@ -7453,11 +7453,11 @@ InstructionCost LoopVectorizationPlanner::cost(VPlan &Plan,
   return Cost;
 }
 
-VPlan &LoopVectorizationPlanner::getBestPlan() const {
+std::pair<ElementCount, VPlan &> LoopVectorizationPlanner::getBestPlan() const {
   // If there is a single VPlan with a single VF, return it directly.
   VPlan &FirstPlan = *VPlans[0];
   if (VPlans.size() == 1 && size(FirstPlan.vectorFactors()) == 1)
-    return FirstPlan;
+    return {*FirstPlan.vectorFactors().begin(), FirstPlan};
 
   VPlan *BestPlan = &FirstPlan;
----------------
ayalz wrote:

Note (independent of this patch) a slight discrepancy in recording an initial {BestPlan, BestFactor} pair as {FirstPlan, ScalarCost or Max cost}, rather than having BestFactor be a factor of BestPlan. Somewhat more consistent to set BestPlan initially to ScalarPlan instead?

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


More information about the llvm-commits mailing list