[clang] [OpenCL][NVPTX] Don't set calling convention for OpenCL kernel (PR #170170)
Hongyu Chen via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 1 19:37:06 PST 2025
================
@@ -277,7 +277,9 @@ void NVPTXTargetCodeGenInfo::setTargetAttributes(
}
}
// Attach kernel metadata directly if compiling for NVPTX.
- if (FD->hasAttr<DeviceKernelAttr>())
+ // NOTE: Don't set kernel calling convention for handled OpenCL kernel,
+ // otherwise the stub version of kernel would be incorrect.
+ if (FD->hasAttr<DeviceKernelAttr>() && !M.getLangOpts().OpenCL)
----------------
XChy wrote:
In the context here, I didn't find a way to check whether it's a stub unless by the mangled name. So I apply this code to the ones without `__clang_ocl_kern_imp_` prefix in the mangled name.
https://github.com/llvm/llvm-project/pull/170170
More information about the cfe-commits
mailing list