[llvm] [AMDGPU] Capping max number of registers for indirect calls (PR #199765)

Janek van Oirschot via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 7 21:46:05 PDT 2026


================
@@ -308,6 +309,12 @@ void MCResourceInfo::gatherResourceInfo(
     }
   });
 
+  const GCNSubtarget &ST = MF.getSubtarget<GCNSubtarget>();
+  std::pair<unsigned, unsigned> MaxNumVectorRegs =
+      ST.getMaxNumVectorRegs(MF.getFunction());
+  unsigned MaxAllowedVGPRs = MaxNumVectorRegs.first;
+  unsigned MaxAllowedAGPRs = MaxNumVectorRegs.second;
+  unsigned MaxAllowedSGPRs = ST.getMaxNumSGPRs(MF.getFunction());
----------------
JanekvO wrote:

Can the calls be moved closer to where they're used? AFAIU, this is now adding an unnecessary call (for example, if we're processing the SGPR, there'll be a superfluous call to `getMaxNumVectorRegs`.

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


More information about the llvm-commits mailing list