[clang] [llvm] [OpenMP] Fix convention of SPIRV outline functions (PR #192450)

Nick Sarnie via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 16 07:15:53 PDT 2026


================
@@ -608,6 +608,12 @@ static llvm::Function *emitOutlinedFunctionPrologue(
       llvm::Function::Create(FuncLLVMTy, llvm::GlobalValue::InternalLinkage,
                              FO.FunctionName, &CGM.getModule());
   CGM.SetInternalFunctionAttributes(CD, F, FuncInfo);
+
+  // Adjust the calling convention for SPIR-V targets to avoid mismatches
+  // between callee and caller.
+  if (CGM.getTriple().isSPIRV() && !FO.IsDeviceKernel)
+    F->setCallingConv(llvm::CallingConv::SPIR_FUNC);
----------------
sarnex wrote:

I was hoping `arrangeBuiltinFunctionDeclaration` would handle this but it seems not because it always passes an empty `ExtInfo` to `arrangeLLVMFunctionInfo`

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


More information about the cfe-commits mailing list