[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


================
@@ -479,6 +500,15 @@ SmallVector<VPRegisterUsage, 8> llvm::calculateRegisterUsageForPlan(
   SmallPtrSet<VPValue *, 8> OpenIntervals;
   SmallVector<VPRegisterUsage, 8> RUs(VFs.size());
   SmallVector<SmallMapVector<unsigned, unsigned, 4>, 8> MaxUsages(VFs.size());
+  SmallVector<SmallMapVector<unsigned, Type *, 4>, 8> LargestTypes(VFs.size());
+  auto MaxType = [](Type *CurMax, Type *T) {
+    if (!CurMax)
+      return T;
+    if (TypeSize::isKnownGT(T->getPrimitiveSizeInBits(),
----------------
lukel97 wrote:

Can we assert in this helper that we never try to compare a scalable + fixed type together? Otherwise I don't think we can accurately return the definite largest type for a given fixed/scalable pair.

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


More information about the llvm-commits mailing list