[clang] [OpenCL][NVPTX] Don't set calling convention for OpenCL kernel (PR #170170)

Hongyu Chen via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 2 10:47:38 PST 2025


================
@@ -441,7 +441,8 @@ void AMDGPUTargetCodeGenInfo::setTargetAttributes(
   const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D);
   if (FD) {
     setFunctionDeclAttributes(FD, F, M);
-    if (FD->hasAttr<DeviceKernelAttr>() && !M.getLangOpts().OpenCL)
+    if (FD->hasAttr<DeviceKernelAttr>() &&
+        !GV->getName().starts_with("__clang_ocl_kern_imp_"))
----------------
XChy wrote:

Yep, I think this code in setTargetAttributes is redundant. Removing this code from AMDGPU/NVPTX/SPIRV works too, except for attributes like `[[clang::amdgpu_kernel]]`. Fix it in SemaType now.

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


More information about the cfe-commits mailing list