[X86] Enable tail calls for CallingConv::Swift

It's currently only enabled on AArch64 (enabled in r281376).

llvm-svn: 357809
This commit is contained in:
Francis Visoiu Mistrih 2019-04-05 20:18:25 +00:00
parent ab051a378c
commit 9d9d1b6b2b
2 changed files with 16 additions and 4 deletions

View File

@ -2941,6 +2941,8 @@ static bool mayTailCallThisCC(CallingConv::ID CC) {
case CallingConv::X86_StdCall:
case CallingConv::X86_VectorCall:
case CallingConv::X86_FastCall:
// Swift:
case CallingConv::Swift:
return true;
default:
return canGuaranteeTCO(CC);

View File

@ -1,11 +1,21 @@
; RUN: llc -mtriple x86_64-unknown-windows-msvc -filetype asm -o - %s | FileCheck %s
; RUN: llc -mtriple x86_64-- -filetype asm -o - %s | FileCheck %s
; RUN: llc -mtriple x86_64-unknown-windows-msvc -filetype asm -o - %s | FileCheck %s --check-prefix=MSVC
define swiftcc void @f() {
%1 = alloca i8
ret void
}
; CHECK-LABEL: f
; CHECK: .seh_stackalloc 8
; CHECK: .seh_endprologue
; MSVC-LABEL: f
; MSVC: .seh_stackalloc 8
; MSVC: .seh_endprologue
declare swiftcc i64 @myFunc()
define swiftcc i64 @myFunc2() nounwind {
%r = tail call swiftcc i64 @myFunc()
ret i64 %r
}
; CHECK-LABEL: myFunc2
; CHECK: jmp myFunc
; CHECK-NOT: call