mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 07:31:53 +00:00
3e407efb8b
Summary: A small bit that I missed when I updated the X86 backend to account for the Win64 calling convention on non-Windows. Now we don't use dead non-volatile registers when emitting a Win64 indirect tail call on non-Windows. Should fix PR23710. Test Plan: Added test for the correct behavior based on the case I posted to PR23710. Reviewers: rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10258 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239111 91177308-0d34-0410-b5e6-96231b3b80d8
67 lines
1.6 KiB
LLVM
67 lines
1.6 KiB
LLVM
; RUN: llc < %s -mtriple=x86_64-pc-linux | FileCheck %s
|
|
|
|
declare x86_64_win64cc void @win64_callee(i32)
|
|
declare x86_64_win64cc void (i32)* @win64_indirect()
|
|
declare x86_64_win64cc void @win64_other(i32)
|
|
declare void @sysv_callee(i32)
|
|
declare void (i32)* @sysv_indirect()
|
|
declare void @sysv_other(i32)
|
|
|
|
define void @sysv_caller(i32 %p1) {
|
|
entry:
|
|
tail call x86_64_win64cc void @win64_callee(i32 %p1)
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: sysv_caller:
|
|
; CHECK: subq $40, %rsp
|
|
; CHECK: callq win64_callee
|
|
; CHECK: addq $40, %rsp
|
|
; CHECK: retq
|
|
|
|
define x86_64_win64cc void @win64_caller(i32 %p1) {
|
|
entry:
|
|
tail call void @sysv_callee(i32 %p1)
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: win64_caller:
|
|
; CHECK: callq sysv_callee
|
|
; CHECK: retq
|
|
|
|
define void @sysv_matched(i32 %p1) {
|
|
tail call void @sysv_callee(i32 %p1)
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: sysv_matched:
|
|
; CHECK: jmp sysv_callee # TAILCALL
|
|
|
|
define x86_64_win64cc void @win64_matched(i32 %p1) {
|
|
tail call x86_64_win64cc void @win64_callee(i32 %p1)
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: win64_matched:
|
|
; CHECK: jmp win64_callee # TAILCALL
|
|
|
|
define x86_64_win64cc void @win64_indirect_caller(i32 %p1) {
|
|
%1 = call x86_64_win64cc void (i32)* @win64_indirect()
|
|
call x86_64_win64cc void @win64_other(i32 0)
|
|
tail call x86_64_win64cc void %1(i32 %p1)
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: win64_indirect_caller:
|
|
; CHECK: jmpq *%{{rax|rcx|rdx|r8|r9|r11}} # TAILCALL
|
|
|
|
define void @sysv_indirect_caller(i32 %p1) {
|
|
%1 = call void (i32)* @sysv_indirect()
|
|
call void @sysv_other(i32 0)
|
|
tail call void %1(i32 %p1)
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: sysv_indirect_caller:
|
|
; CHECK: jmpq *%{{rax|rcx|rdx|rsi|rdi|r8|r9|r11}} # TAILCALL
|