80 lines · plain
1; RUN: llc < %s -mtriple=x86_64-pc-win32 | FileCheck %s2 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 }8 9declare ptr @A_ctor(ptr returned)10declare ptr @B_ctor(ptr returned, i32)11 12declare ptr @A_ctor_nothisret(ptr)13declare ptr @B_ctor_nothisret(ptr, i32)14 15define ptr @C_ctor(ptr %this, i32 %y) {16entry:17; CHECK-LABEL: C_ctor:18; CHECK: jmp B_ctor # TAILCALL19 %call = tail call ptr @B_ctor(ptr %this, i32 %y)20 ret ptr %this21}22 23define ptr @C_ctor_nothisret(ptr %this, i32 %y) {24entry:25; CHECK-LABEL: C_ctor_nothisret:26; CHECK-NOT: jmp B_ctor_nothisret27 %call = tail call ptr @B_ctor_nothisret(ptr %this, i32 %y)28 ret ptr %this29}30 31define ptr @D_ctor(ptr %this, i32 %y) {32entry:33; CHECK-LABEL: D_ctor:34; CHECK: movq %rcx, [[SAVETHIS:%r[0-9a-z]+]]35; CHECK: callq A_ctor36; CHECK: movq [[SAVETHIS]], %rcx37; CHECK: jmp B_ctor # TAILCALL38 %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)41 ret ptr %call42}43 44define ptr @D_ctor_nothisret(ptr %this, i32 %y) {45entry:46; CHECK-LABEL: D_ctor_nothisret:47; CHECK: movq %rcx, [[SAVETHIS:%r[0-9a-z]+]]48; CHECK: callq A_ctor_nothisret49; CHECK: movq [[SAVETHIS]], %rcx50; CHECK-NOT: jmp B_ctor_nothisret51 %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)54 ret ptr %call55}56 57define ptr @E_ctor(ptr %this, i32 %x) {58entry:59; CHECK-LABEL: E_ctor:60; CHECK: movq %rcx, [[SAVETHIS:%r[0-9a-z]+]]61; CHECK: callq B_ctor62; CHECK: movq [[SAVETHIS]], %rcx63; CHECK: jmp B_ctor # TAILCALL64 %call = tail call ptr @B_ctor(ptr %this, i32 %x)65 %call4 = tail call ptr @B_ctor(ptr %this, i32 %x)66 ret ptr %this67}68 69define ptr @E_ctor_nothisret(ptr %this, i32 %x) {70entry:71; CHECK-LABEL: E_ctor_nothisret:72; CHECK: movq %rcx, [[SAVETHIS:%r[0-9a-z]+]]73; CHECK: callq B_ctor_nothisret74; CHECK: movq [[SAVETHIS]], %rcx75; CHECK-NOT: jmp B_ctor_nothisret76 %call = tail call ptr @B_ctor_nothisret(ptr %this, i32 %x)77 %call4 = tail call ptr @B_ctor_nothisret(ptr %this, i32 %x)78 ret ptr %this79}80