[llvm] [AMDGPU] Make `getAssumedAddrSpace` return AS1 for pointer kernel arguments (PR #137488)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Mon May 5 13:39:31 PDT 2025


================
@@ -951,6 +951,10 @@ bool AMDGPUTargetMachine::isNoopAddrSpaceCast(unsigned SrcAS,
 }
 
 unsigned AMDGPUTargetMachine::getAssumedAddrSpace(const Value *V) const {
+  if (auto *Arg = dyn_cast<Argument>(V);
+      Arg && AMDGPU::isKernelCC(Arg->getParent()))
+    return AMDGPUAS::GLOBAL_ADDRESS;
----------------
shiltian wrote:

I don't know if we are able to do device memory allocation in AS4 but I rule out `byref` argument anyway.

> But if we're fixing clang to do the right thing, shouldn't need to handle the flat case

We will do that, but the fix in clang will take more time and I really want to get rid of the special handling in the attributor.

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


More information about the llvm-commits mailing list