Skip to content

X86: swiftailcc fix csr save list and register mask on i386 #2788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions llvm/lib/Target/X86/X86RegisterInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ X86RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
return CSR_Win64_NoSSE_SaveList;
return CSR_Win64_SaveList;
case CallingConv::SwiftTail:
if (!Is64Bit)
return CSR_32_SaveList;
return IsWin64 ? CSR_Win64_SwiftTail_SaveList : CSR_64_SwiftTail_SaveList;
case CallingConv::X86_64_SysV:
if (CallsEHReturn)
Expand Down Expand Up @@ -468,6 +470,8 @@ X86RegisterInfo::getCallPreservedMask(const MachineFunction &MF,
case CallingConv::Win64:
return CSR_Win64_RegMask;
case CallingConv::SwiftTail:
if (!Is64Bit)
return CSR_32_RegMask;
return IsWin64 ? CSR_Win64_SwiftTail_RegMask : CSR_64_SwiftTail_RegMask;
case CallingConv::X86_64_SysV:
return CSR_64_RegMask;
Expand Down
12 changes: 12 additions & 0 deletions llvm/test/CodeGen/X86/swifttail-async-i386.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
; RUN: llc -mtriple=i386-apple-darwin %s -o - | FileCheck %s

declare void @clobber()

declare swifttailcc void @swifttail_callee()
define swifttailcc void @swifttail() {
; CHECK-LABEL: swifttail:
; CHECK-NOT: %rbx
call void @clobber()
tail call swifttailcc void @swifttail_callee()
ret void
}