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

Shilei Tian llvmlistbot at llvm.org
Fri Apr 25 08:56:29 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:

> My thinking is that this way we could extend this check to most other targets as well (mainly excluding wasm and any other that may be using multiple alloca address spaces).

It's gonna need to change a reasonable number of test cases which don't use any triple in the RUN line, and have `alloca` in multiple ASs, especially some of the test cases explicitly want to test alloca in different ASs.

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


More information about the Mlir-commits mailing list