[llvm] [mlir] [AMDGPU][Verifier] Check address space of `alloca` instruction (PR #135820)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 25 08:04:43 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);
----------------
arsenm wrote:
The problem with that is the datalayout isn't always right. Even if you have the triple, the right datalaoyut doesn't get pulled. e.g.
```
; RUN llvm-as < %s
target triple = "amdgcn-amd-amdhsa"
define void @foo() {
%alloca = alloca i32
store volatile i32 0, ptr %alloca
ret void
}
```
In this case DL.getAllocaAddrSpace() is 0
https://github.com/llvm/llvm-project/pull/135820
More information about the llvm-commits
mailing list