Skip to content

Commit 67e69d5

Browse files
committed
X86: force enable the mandatory tailcall on Win64
Enable the guaranteed tailcall on Windows x86_64 when we encounter a Swift function call. This function will not conform to the Windows prologue requirements which will implicitly break the unwinder and the debugger, but is required to enable the proper Concurrency behaviour for non-trivial programs. This requires associated changes in the Swift repository to update the test expectations.
1 parent e2c55df commit 67e69d5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clang/lib/Basic/Targets/X86.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,11 +819,10 @@ class LLVM_LIBRARY_VISIBILITY WindowsX86_64TargetInfo
819819
case CC_PreserveAll:
820820
case CC_X86_64SysV:
821821
case CC_Swift:
822+
case CC_SwiftAsync:
822823
case CC_X86RegCall:
823824
case CC_OpenCLKernel:
824825
return CCCR_OK;
825-
case CC_SwiftAsync:
826-
return CCCR_Error;
827826
default:
828827
return CCCR_Warning;
829828
}

llvm/lib/Target/X86/X86FrameLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,8 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF,
15101510
// Space reserved for stack-based arguments when making a (ABI-guaranteed)
15111511
// tail call.
15121512
unsigned TailCallArgReserveSize = -X86FI->getTCReturnAddrDelta();
1513-
if (TailCallArgReserveSize && IsWin64Prologue)
1513+
if (TailCallArgReserveSize && IsWin64Prologue &&
1514+
!MF.getFunction().getAttributes().hasAttrSomewhere(Attribute::SwiftAsync))
15141515
report_fatal_error("Can't handle guaranteed tail call under win64 yet");
15151516

15161517
const bool EmitStackProbeCall =

0 commit comments

Comments
 (0)