[llvm] [llvm-calc-occupancy] Fix build after SGPR queries moved to TargetParser (PR #213023)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 06:32:52 PDT 2026


https://github.com/michaelselehov created https://github.com/llvm/llvm-project/pull/213023

Urgent buildbot fix for #208727.

That PR was developed before #209848, which moved the SGPR count queries into TargetParser and removed `AMDGPU::IsaInfo::getAddressableNumSGPRs()`, so `llvm-calc-occupancy.cpp` fails to compile on current `main`:

```
llvm-calc-occupancy.cpp:229:41: error: no member named 'getAddressableNumSGPRs' in namespace 'llvm::AMDGPU::IsaInfo'
```

This switches to the equivalent `GCNSubtarget::getAddressableNumSGPRs()`, which forwards to the TargetParser version. All other `IsaInfo::*` calls in the file were checked against the new API and are unaffected.

Verified locally: `ninja llvm-calc-occupancy` builds clean, `llvm/test/tools/llvm-calc-occupancy` passes, and the reported addressable SGPR count is unchanged (102 on gfx90a).

>From 924ffe8f324171096bcd1da882ea7d2f7478d9fc Mon Sep 17 00:00:00 2001
From: Michael Selehov <michael.selehov at amd.com>
Date: Thu, 30 Jul 2026 08:31:55 -0500
Subject: [PATCH] [llvm-calc-occupancy] Fix build after SGPR queries moved to
 TargetParser

The tool was developed before #209848, which moved the SGPR count queries
into TargetParser and removed AMDGPU::IsaInfo::getAddressableNumSGPRs().
Use the equivalent GCNSubtarget::getAddressableNumSGPRs() instead, which
forwards to the TargetParser version.

This unbreaks several buildbots.
---
 llvm/tools/llvm-calc-occupancy/llvm-calc-occupancy.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/tools/llvm-calc-occupancy/llvm-calc-occupancy.cpp b/llvm/tools/llvm-calc-occupancy/llvm-calc-occupancy.cpp
index 916c9fb941626..ed44d7531640e 100644
--- a/llvm/tools/llvm-calc-occupancy/llvm-calc-occupancy.cpp
+++ b/llvm/tools/llvm-calc-occupancy/llvm-calc-occupancy.cpp
@@ -226,7 +226,7 @@ int main(int argc, char **argv) {
   unsigned AddrLocalMem = AMDGPU::IsaInfo::getAddressableLocalMemorySize(STI);
   unsigned AddrVGPRs =
       AMDGPU::IsaInfo::getAddressableNumVGPRs(STI, DynVGPRBlockSizeEff);
-  unsigned AddrSGPRs = AMDGPU::IsaInfo::getAddressableNumSGPRs(STI);
+  unsigned AddrSGPRs = ST.getAddressableNumSGPRs();
   unsigned MaxWGSize = AMDGPU::IsaInfo::getMaxFlatWorkGroupSize();
 
   // Warn about inputs that exceed the hardware's physical capacity: such a



More information about the llvm-commits mailing list