MSVC header files using vectorcall to differentiate overloaded functions, which
causes failure for AMDGPU target. This is because clang does not check function
calling convention based on function target.
This patch checks calling convention using the proper target info.
This is rather convoluted.
Perhaps it would be easier to understand if the code is restructured. along these lines:
// Returns a tuple indicating whether we need to check TargetInfo on host/device side of the compilation bool CheckHost = false, CheckDevice=false; switch (CudaTarget) { case CFT_HostDevice: CheckHost = true; CheckDevice=true; break; case CFT_Host: CheckHost = true; break; case CFG_Device: case CFG_Global: CheckDevice=true; break; } } (); TargetInfo *HostTI = CudaIsDevice ? Aux : &TI; TargetInfo * DeviceTI = CudaIsDevice ? &TI : Aux; if (CheckHost && HostTI) HostTI->checkCallingConvention(CC); if (CheckDevice && DeviceTI) DeviceTI->checkCallingConvention(CC);