1 ; RUN: llc < %s -mtriple=x86_64-pc-win32 | FileCheck %s
3 %struct.A = type { i8 }
4 %struct.B = type { i32 }
5 %struct.C = type { %struct.B }
6 %struct.D = type { %struct.B }
7 %struct.E = type { %struct.B }
9 declare ptr @A_ctor(ptr returned)
10 declare ptr @B_ctor(ptr returned, i32)
12 declare ptr @A_ctor_nothisret(ptr)
13 declare ptr @B_ctor_nothisret(ptr, i32)
15 define ptr @C_ctor(ptr %this, i32 %y) {
17 ; CHECK-LABEL: C_ctor:
18 ; CHECK: jmp B_ctor # TAILCALL
19 %call = tail call ptr @B_ctor(ptr %this, i32 %y)
23 define ptr @C_ctor_nothisret(ptr %this, i32 %y) {
25 ; CHECK-LABEL: C_ctor_nothisret:
26 ; CHECK-NOT: jmp B_ctor_nothisret
27 %call = tail call ptr @B_ctor_nothisret(ptr %this, i32 %y)
31 define ptr @D_ctor(ptr %this, i32 %y) {
33 ; CHECK-LABEL: D_ctor:
34 ; CHECK: movq %rcx, [[SAVETHIS:%r[0-9a-z]+]]
36 ; CHECK: movq [[SAVETHIS]], %rcx
37 ; CHECK: jmp B_ctor # TAILCALL
38 %call = tail call ptr @A_ctor(ptr %this)
39 %call2 = tail call ptr @B_ctor(ptr %this, i32 %y)
40 ; (this next line would never be generated by Clang, actually)
44 define ptr @D_ctor_nothisret(ptr %this, i32 %y) {
46 ; CHECK-LABEL: D_ctor_nothisret:
47 ; CHECK: movq %rcx, [[SAVETHIS:%r[0-9a-z]+]]
48 ; CHECK: callq A_ctor_nothisret
49 ; CHECK: movq [[SAVETHIS]], %rcx
50 ; CHECK-NOT: jmp B_ctor_nothisret
51 %call = tail call ptr @A_ctor_nothisret(ptr %this)
52 %call2 = tail call ptr @B_ctor_nothisret(ptr %this, i32 %y)
53 ; (this next line would never be generated by Clang, actually)
57 define ptr @E_ctor(ptr %this, i32 %x) {
59 ; CHECK-LABEL: E_ctor:
60 ; CHECK: movq %rcx, [[SAVETHIS:%r[0-9a-z]+]]
62 ; CHECK: movq [[SAVETHIS]], %rcx
63 ; CHECK: jmp B_ctor # TAILCALL
64 %call = tail call ptr @B_ctor(ptr %this, i32 %x)
65 %call4 = tail call ptr @B_ctor(ptr %this, i32 %x)
69 define ptr @E_ctor_nothisret(ptr %this, i32 %x) {
71 ; CHECK-LABEL: E_ctor_nothisret:
72 ; CHECK: movq %rcx, [[SAVETHIS:%r[0-9a-z]+]]
73 ; CHECK: callq B_ctor_nothisret
74 ; CHECK: movq [[SAVETHIS]], %rcx
75 ; CHECK-NOT: jmp B_ctor_nothisret
76 %call = tail call ptr @B_ctor_nothisret(ptr %this, i32 %x)
77 %call4 = tail call ptr @B_ctor_nothisret(ptr %this, i32 %x)