[llvm] [NVPTX] Improve kernel byval parameter lowering (PR #136008)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 16 16:14:56 PDT 2025


================
@@ -12,7 +12,7 @@ define ptx_kernel void @_Z11TakesStruct1SPi(ptr byval(%struct.S) nocapture reado
 entry:
 ; CHECK-LABEL: @_Z11TakesStruct1SPi
 ; PTX-LABEL: .visible .entry _Z11TakesStruct1SPi(
-; CHECK: addrspacecast ptr %input to ptr addrspace(101)
+; CHECK: call ptr addrspace(101) @llvm.nvvm.internal.noop.addrspacecast.p101.p0(ptr %input)
----------------
Artem-B wrote:

Naming nit: I think `noop.addrspacecast` does not quite match what we want to do here. It's not that we're actually casting the pointer. It's more that we're letting LLVM know the actual AS of the argument which happens to be represented by a generic pointer. 

So, technically it does look like a no-op cast (changes AS, does not actually do anything). I think "wrapped" that you used in the description would be a better name here. How about `llvm.nvvm.internal.addrspace.wrap` ?

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


More information about the llvm-commits mailing list