@@ -5544,12 +5544,12 @@ bool Sema::CheckCallingConvAttr(const ParsedAttr &Attrs, CallingConv &CC,
5544
5544
}
5545
5545
5546
5546
TargetInfo::CallingConvCheckResult A = TargetInfo::CCCR_OK;
5547
+ auto *Aux = Context.getAuxTargetInfo ();
5547
5548
// CUDA functions may have host and/or device attributes which indicate
5548
5549
// their targeted execution environment, therefore the calling convention
5549
5550
// of functions in CUDA should be checked against the target deduced based
5550
5551
// on their host/device attributes.
5551
5552
if (LangOpts.CUDA ) {
5552
- auto *Aux = Context.getAuxTargetInfo ();
5553
5553
assert (FD || CFT != CUDAFunctionTarget::InvalidTarget);
5554
5554
auto CudaTarget = FD ? CUDA ().IdentifyTarget (FD) : CFT;
5555
5555
bool CheckHost = false , CheckDevice = false ;
@@ -5574,6 +5574,15 @@ bool Sema::CheckCallingConvAttr(const ParsedAttr &Attrs, CallingConv &CC,
5574
5574
A = HostTI->checkCallingConvention (CC);
5575
5575
if (A == TargetInfo::CCCR_OK && CheckDevice && DeviceTI)
5576
5576
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);
5577
5586
} else {
5578
5587
A = TI.checkCallingConvention (CC);
5579
5588
}
0 commit comments