[llvm] [VPlan] Only use selectVectorizationFactor for cross-check (NFCI). (PR #103033)

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 18 03:48:56 PDT 2024


================
@@ -7217,18 +7198,21 @@ InstructionCost LoopVectorizationPlanner::cost(VPlan &Plan,
   return Cost;
 }
 
-ElementCount LoopVectorizationPlanner::getBestVF() {
+VectorizationFactor LoopVectorizationPlanner::getBestVF() {
+  if (VPlans.empty())
+    return VectorizationFactor::Disabled();
   // 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.vectorFactors().begin();
+    return {*FirstPlan.vectorFactors().begin(), 0, 0};
----------------
ayalz wrote:

(Returning zeroes retains current behavior: the single VPlan case corresponds to a UserVF whose cost and scalar-cost are ignored, although the former does have valid cost (the latter is not calculated).)

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


More information about the llvm-commits mailing list