[clang] [clang][HIP] Normalize __cdecl on abstract function types to the device default CC on amdgcnspirv (PR #210882)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 3 05:57:29 PDT 2026


================
@@ -8349,6 +8349,19 @@ static bool handleFunctionTypeAttr(TypeProcessingState &state, ParsedAttr &attr,
     return true;
 
   const FunctionType *fn = unwrapped.get();
+
+  // On amdgcnspirv, __cdecl on an abstract function type has no device-side
+  // equivalent, so normalize it to the device default CC to match an
+  // unadorned function type. Skip named decls and variadic types.
+  if (CC == CC_C && S.getLangOpts().CUDAIsDevice &&
----------------
Fznamznon wrote:

Yeah, we also need to map CC_C to spir_func in ClangCallConvToLLVMCallConv similarly how it is done for DeviceKernel attribute and calling convention. That will break a bit of HLSL tests afaik but I think these are incorrect tests or a bug in HLSL because they test functions without spir_function kernel convention for spirv target.

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


More information about the cfe-commits mailing list