[clang] [clang] Fix inconsistencies with the device_kernel attr on different targets (PR #161905)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 6 07:23:30 PDT 2025


================
@@ -419,9 +419,11 @@ void AMDGPUTargetCodeGenInfo::setTargetAttributes(
     return;
 
   const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D);
-  if (FD)
+  if (FD) {
     setFunctionDeclAttributes(FD, F, M);
-
+    if (FD->hasAttr<DeviceKernelAttr>() && !M.getLangOpts().OpenCL)
+      F->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL);
----------------
jhuber6 wrote:

Yeah, guess we can just leave OpenCL alone for now

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


More information about the cfe-commits mailing list