1; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s 2 3; Each musttail call should fail to validate. 4 5declare x86_stdcallcc void @cc_mismatch_callee() 6define void @cc_mismatch() { 7; CHECK: mismatched calling conv 8 musttail call x86_stdcallcc void @cc_mismatch_callee() 9 ret void 10} 11 12declare void @more_parms_callee(i32) 13define void @more_parms() { 14; CHECK: mismatched parameter counts 15 musttail call void @more_parms_callee(i32 0) 16 ret void 17} 18 19declare void @mismatched_intty_callee(i8) 20define void @mismatched_intty(i32) { 21; CHECK: mismatched parameter types 22 musttail call void @mismatched_intty_callee(i8 0) 23 ret void 24} 25 26declare void @mismatched_vararg_callee(i8*, ...) 27define void @mismatched_vararg(i8*) { 28; CHECK: mismatched varargs 29 musttail call void (i8*, ...) @mismatched_vararg_callee(i8* null) 30 ret void 31} 32 33; We would make this an implicit sret parameter, which would disturb the 34; tail call. 35declare { i32, i32, i32 } @mismatched_retty_callee(i32) 36define void @mismatched_retty(i32) { 37; CHECK: mismatched return types 38 musttail call { i32, i32, i32 } @mismatched_retty_callee(i32 0) 39 ret void 40} 41 42declare void @mismatched_byval_callee({ i32 }*) 43define void @mismatched_byval({ i32 }* byval %a) { 44; CHECK: mismatched ABI impacting function attributes 45 musttail call void @mismatched_byval_callee({ i32 }* %a) 46 ret void 47} 48 49declare void @mismatched_inreg_callee(i32 inreg) 50define void @mismatched_inreg(i32 %a) { 51; CHECK: mismatched ABI impacting function attributes 52 musttail call void @mismatched_inreg_callee(i32 inreg %a) 53 ret void 54} 55 56declare void @mismatched_sret_callee(i32* sret) 57define void @mismatched_sret(i32* %a) { 58; CHECK: mismatched ABI impacting function attributes 59 musttail call void @mismatched_sret_callee(i32* sret %a) 60 ret void 61} 62 63declare void @mismatched_alignment_callee(i32* byval align 8) 64define void @mismatched_alignment(i32* byval align 4 %a) { 65; CHECK: mismatched ABI impacting function attributes 66 musttail call void @mismatched_alignment_callee(i32* byval align 8 %a) 67 ret void 68} 69 70declare i32 @not_tail_pos_callee() 71define i32 @not_tail_pos() { 72; CHECK: musttail call must be precede a ret with an optional bitcast 73 %v = musttail call i32 @not_tail_pos_callee() 74 %w = add i32 %v, 1 75 ret i32 %w 76} 77 78define void @inline_asm() { 79; CHECK: cannot use musttail call with inline asm 80 musttail call void asm "ret", ""() 81 ret void 82} 83