@@ -5544,12 +5544,12 @@ bool Sema::CheckCallingConvAttr(const ParsedAttr &Attrs, CallingConv &CC,
55445544 }
55455545
55465546 TargetInfo::CallingConvCheckResult A = TargetInfo::CCCR_OK;
5547+ auto *Aux = Context.getAuxTargetInfo ();
55475548 // CUDA functions may have host and/or device attributes which indicate
55485549 // their targeted execution environment, therefore the calling convention
55495550 // of functions in CUDA should be checked against the target deduced based
55505551 // on their host/device attributes.
55515552 if (LangOpts.CUDA ) {
5552- auto *Aux = Context.getAuxTargetInfo ();
55535553 assert (FD || CFT != CUDAFunctionTarget::InvalidTarget);
55545554 auto CudaTarget = FD ? CUDA ().IdentifyTarget (FD) : CFT;
55555555 bool CheckHost = false , CheckDevice = false ;
@@ -5574,6 +5574,15 @@ bool Sema::CheckCallingConvAttr(const ParsedAttr &Attrs, CallingConv &CC,
55745574 A = HostTI->checkCallingConvention (CC);
55755575 if (A == TargetInfo::CCCR_OK && CheckDevice && DeviceTI)
55765576 A = DeviceTI->checkCallingConvention (CC);
5577+ } else if (LangOpts.SYCLIsDevice && TI.getTriple ().isAMDGPU () &&
5578+ CC == CC_X86VectorCall) {
5579+ // Assuming SYCL Device AMDGPU CC_X86VectorCall functions are always to be
5580+ // emitted on the host. The MSVC STL has CC-based specializations so we
5581+ // cannot change the CC to be the default as that will cause a clash with
5582+ // another specialization.
5583+ A = TI.checkCallingConvention (CC);
5584+ if (Aux && A != TargetInfo::CCCR_OK)
5585+ A = Aux->checkCallingConvention (CC);
55775586 } else {
55785587 A = TI.checkCallingConvention (CC);
55795588 }
0 commit comments