[Mlir-commits] [llvm] [mlir] [AMDGPU][Verifier] Check address space of `alloca` instruction (PR #135820)

Nikita Popov llvmlistbot at llvm.org
Fri Apr 25 08:56:11 PDT 2025


================
@@ -4395,6 +4395,11 @@ void Verifier::visitAllocaInst(AllocaInst &AI) {
     verifySwiftErrorValue(&AI);
   }
 
+  if (TT.isAMDGPU()) {
+    Check(AI.getAddressSpace() == AMDGPUAS::PRIVATE_ADDRESS,
+          "alloca on amdgpu must be in addrspace(5)", &AI);
----------------
nikic wrote:

@shiltian Yes, that's the generic case. But for AMDGPU, and most other targets, you know that the address space specified in the data layout is the only supported one.

(That's why I suggested that a way to handle the generic case is to allow specifying a *list* of alloca address spaces in data layout, in which case we *could* say that it must be part of that list. We just can't limit this to a single address space for all targets.)

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


More information about the Mlir-commits mailing list