[X86] Clean up the tail call eligibility logic
[oota-llvm.git] / test / CodeGen / X86 / tailcall-msvc-conventions.ll
1 ; RUN: llc -mtriple=i686-windows-msvc -O1 < %s | FileCheck %s
2 ; RUN: llc -mtriple=i686-windows-msvc -O0 < %s | FileCheck %s
3
4 ; The MSVC family of x86 calling conventions makes tail calls really tricky.
5 ; Tests of all the various combinations should live here.
6
7 declare i32 @cdecl_i32()
8 declare void @cdecl_void()
9
10 ; Don't allow tail calling these cdecl functions, because we need to clear the
11 ; incoming stack arguments for these argument-clearing conventions.
12
13 define x86_thiscallcc void @thiscall_cdecl_notail(i32 %a, i32 %b, i32 %c) {
14   tail call void @cdecl_void()
15   ret void
16 }
17 ; CHECK-LABEL: thiscall_cdecl_notail: # @thiscall_cdecl_notail
18 ; CHECK: calll _cdecl_void
19 ; CHECK: retl $8
20 define x86_stdcallcc void @stdcall_cdecl_notail(i32 %a, i32 %b, i32 %c) {
21   tail call void @cdecl_void()
22   ret void
23 }
24 ; CHECK-LABEL: _stdcall_cdecl_notail@12: # @stdcall_cdecl_notail
25 ; CHECK: calll _cdecl_void
26 ; CHECK: retl $12
27 define x86_vectorcallcc void @vectorcall_cdecl_notail(i32 inreg %a, i32 inreg %b, i32 %c) {
28   tail call void @cdecl_void()
29   ret void
30 }
31 ; CHECK-LABEL: vectorcall_cdecl_notail@@12: # @vectorcall_cdecl_notail
32 ; CHECK: calll _cdecl_void
33 ; CHECK: retl $4
34 define x86_fastcallcc void @fastcall_cdecl_notail(i32 inreg %a, i32 inreg %b, i32 %c) {
35   tail call void @cdecl_void()
36   ret void
37 }
38 ; CHECK-LABEL: @fastcall_cdecl_notail@12: # @fastcall_cdecl_notail
39 ; CHECK: calll _cdecl_void
40 ; CHECK: retl $4