[llvm] [AMDGPU] Introduce address space 13 for VGPR as memory (PR #208557)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 12:55:22 PDT 2026


================
@@ -122,8 +122,16 @@ void llvm::verifyAMDGPUAlloca(VerifierSupport &VS, const AllocaInst &AI) {
   if (!VS.TT.isAMDGPU())
     return;
 
-  if (AI.getAddressSpace() != AMDGPUAS::PRIVATE_ADDRESS)
-    VS.CheckFailed("alloca on amdgpu must be in addrspace(5)", &AI);
+  if (AI.getAddressSpace() != AMDGPUAS::PRIVATE_ADDRESS &&
+      AI.getAddressSpace() != AMDGPUAS::VGPR)
+    VS.CheckFailed("alloca on amdgpu must be in addrspace(5) or addrspace(13)",
+                   &AI);
+
+  // Only static allocas can live in VGPRs; a dynamically sized one has no
+  // register-file representation. (Other address spaces are already rejected
+  // above, so this only adds the more specific diagnostic for addrspace(13).)
+  if (!AI.isStaticAlloca() && AI.getAddressSpace() == AMDGPUAS::VGPR)
----------------
arsenm wrote:

No, this isn't about the comment. You can still have an alloca outside of the entry block which is equivalent to a dynamic alloca. You'd have to check where it is, which isn't done here.

But this also seems like putting unreasonable restrictions on such a fundamental instruction

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


More information about the llvm-commits mailing list