[llvm] [VPlan] Add the cost of spills when considering register pressure (PR #179646)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 11 07:13:31 PST 2026


================
@@ -4687,22 +4684,23 @@ LoopVectorizationPlanner::selectInterleaveCount(VPlan &Plan, ElementCount VF,
   if (hasFindLastReductionPhi(Plan))
     return 1;
 
+  VPRegisterUsage R =
+      calculateRegisterUsageForPlan(Plan, {VF}, TTI, CM.ValuesToIgnore)[0];
+
   // If we did not calculate the cost for VF (because the user selected the VF)
   // then we calculate the cost of VF here.
   if (LoopCost == 0) {
     if (VF.isScalar())
       LoopCost = CM.expectedCost(VF);
     else
-      LoopCost = cost(Plan, VF);
+      LoopCost = cost(Plan, VF, &R);
----------------
lukel97 wrote:

Should we be plumbing through VPRegisterUsage here? Can we just add the cost at the LoopVectorizationPlanner::computeBestVF call site?

selectInterleaveCount already has its own register pressure costing thing going on and I'm not sure if we want to interfere with it

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


More information about the llvm-commits mailing list