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

Shilei Tian llvmlistbot at llvm.org
Fri Apr 25 08:49:37 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);
----------------
shiltian wrote:

> Might be better to check it against the alloca addrspace from the data layout instead of hardcoding 5?

I'm actually confused now. There is quite a long debate in https://github.com/llvm/llvm-project/pull/136865 on whether DL can be reliable for this check and I think both @arsenm and @nikic explicitly said DL is just a hint and it doesn't mean anything.

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


More information about the Mlir-commits mailing list