@@ -94,6 +94,10 @@ unsigned CodeGenTypes::ClangCallConvToLLVMCallConv(CallingConv CC) {
9494 return llvm::CallingConv::AMDGPU_KERNEL;
9595 if (CGM.getTriple ().isNVPTX ())
9696 return llvm::CallingConv::PTX_Kernel;
97+ if (CGM.getLangOpts ().SYCLIsNativeCPU )
98+ return CGM.getTarget ().getDefaultCallingConv ();
99+ if (CGM.getLangOpts ().SYCLIsDevice )
100+ return CGM.getTarget ().getDefaultCallingConv ();
97101 llvm_unreachable (" Unknown kernel calling convention" );
98102 }
99103 case CC_PreserveMost:
@@ -2628,8 +2632,8 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
26282632 NumElemsParam);
26292633 }
26302634
2631- if (DeviceKernelAttr::isOpenCLSpelling (
2632- TargetDecl-> getAttr <DeviceKernelAttr>() ) &&
2635+ if (TargetDecl-> hasAttr < DeviceKernelAttr>() &&
2636+ ( getLangOpts (). OpenCL || getLangOpts (). SYCLIsDevice ) &&
26332637 CallingConv != CallingConv::CC_C &&
26342638 CallingConv != CallingConv::CC_SpirFunction) {
26352639 // Check CallingConv to avoid adding uniform-work-group-size attribute to
@@ -3013,8 +3017,9 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
30133017 // > data type, the OpenCL compiler can assume that the pointee is always
30143018 // > appropriately aligned as required by the data type.
30153019 if (TargetDecl &&
3016- DeviceKernelAttr::isOpenCLSpelling (
3017- TargetDecl->getAttr <DeviceKernelAttr>()) &&
3020+
3021+ (TargetDecl->hasAttr <DeviceKernelAttr>() &&
3022+ (getLangOpts ().OpenCL || getLangOpts ().SYCLIsDevice )) &&
30183023 ParamType->isPointerType ()) {
30193024 QualType PTy = ParamType->getPointeeType ();
30203025 if (!PTy->isIncompleteType () && PTy->isConstantSizeType ()) {
0 commit comments