[llvm] [AMDGPU] Prefer lower total register usage in regions with spilling (PR #71882)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 21:11:15 PST 2023


================
@@ -102,20 +102,56 @@ bool GCNRegPressure::less(const GCNSubtarget &ST,
     std::min(MaxOccupancy,
              ST.getOccupancyWithNumVGPRs(O.getVGPRNum(ST.hasGFX90AInsts())));
 
+  unsigned MaxVGPRs = ST.getMaxNumVGPRs(MF);
+  unsigned MaxSGPRs = ST.getMaxNumSGPRs(MF);
+
+  bool ExcessVGPR = getVGPRNum(false) > MaxVGPRs || getAGPRNum() > MaxVGPRs;
+  bool ExcessSGPR = getSGPRNum() > MaxSGPRs;
+  bool OtherExcessVGPR =
+      O.getVGPRNum(false) > MaxVGPRs || O.getAGPRNum() > MaxVGPRs;
----------------
arsenm wrote:

Is comparing getAGPRNum to MaxVGPRs correct? They'd be different for gfx90a

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


More information about the llvm-commits mailing list