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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 27 01:25:33 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;
----------------
arsenm wrote:

Probably need to defend against byref values. Ideally we would only use byref, in which case this needs to look at the load from the argument. But then if we're changing the IR calling convention lowering we might as well fix it to emit addrspace(1) in the first place 

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


More information about the llvm-commits mailing list