[clang] [Clang] Forward incoming Indirect parameters across musttail calls (PR #199351)
Xavier Roche via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 14 23:24:15 PDT 2026
xroche wrote:
> Are the checks for isCUDADeviceBuiltinSurfaceType() needed in the latest version? Copying arguments should get routed through EmitAggregateCopy, I think.
Yes, still needed. EmitAggregateCopy only runs for arguments passed indirectly (through memory). On the device side, surface/texture arguments are passed directly as an i64 handle, and for direct arguments EmitCall loads the bytes straight from the forwarded address. The handle conversion lives in EmitAggregateCopy and normally runs when the argument temporary is built, so skipping the temporary skips the conversion.
I verified at the current head: with the checks removed, the musttail caller in CodeGenCUDA/surface.cu loads a raw i64 from @surf instead of calling llvm.nvvm.texsurf.handle.internal. The musttail CHECK lines in that test catch this.
https://github.com/llvm/llvm-project/pull/199351
More information about the cfe-commits
mailing list