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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 23 06:32:46 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:

Can we add another debug line in LoopVectorizationPlanner::computeBestVF? Something like "Spill cost for VF = ". 

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


More information about the llvm-commits mailing list