[llvm-branch-commits] [llvm] [AMDGPU] Apply occupancy-aware register allocation anti-hints (PR #218074)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Sep 13 05:26:42 PDT 2026


================
@@ -4225,22 +4225,56 @@ bool SIRegisterInfo::shouldApplyAntiHints(
   return true;
 }
 
+// Returns true if Reg fits within the current occupancy VGPR budget.
+bool SIRegisterInfo::isRegWithinOccupancyBudget(
+    MCPhysReg Reg, unsigned NumVGPRs, unsigned NumAGPRs,
+    unsigned MaxVGPRsForCurrentOccupancy) const {
+  const TargetRegisterClass *RC = getPhysRegBaseClass(Reg);
+
+  // No VGPR or AGPR usage.
+  if (!RC || (!isVGPRClass(RC) && !isAGPRClass(RC)))
----------------
arsenm wrote:

hasVectorRegisters(RC)?

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


More information about the llvm-branch-commits mailing list