83 lines · plain
1; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s2 3; Each musttail call should fail to validate.4 5declare x86_stdcallcc void @cc_mismatch_callee()6define void @cc_mismatch() {7; CHECK: mismatched calling conv8 musttail call x86_stdcallcc void @cc_mismatch_callee()9 ret void10}11 12declare void @more_parms_callee(i32)13define void @more_parms() {14; CHECK: mismatched parameter counts15 musttail call void @more_parms_callee(i32 0)16 ret void17}18 19declare void @mismatched_intty_callee(i8)20define void @mismatched_intty(i32) {21; CHECK: mismatched parameter types22 musttail call void @mismatched_intty_callee(i8 0)23 ret void24}25 26declare void @mismatched_vararg_callee(ptr, ...)27define void @mismatched_vararg(ptr) {28; CHECK: mismatched varargs29 musttail call void (ptr, ...) @mismatched_vararg_callee(ptr null)30 ret void31}32 33; We would make this an implicit sret parameter, which would disturb the34; tail call.35declare { i32, i32, i32 } @mismatched_retty_callee(i32)36define void @mismatched_retty(i32) {37; CHECK: mismatched return types38 musttail call { i32, i32, i32 } @mismatched_retty_callee(i32 0)39 ret void40}41 42declare void @mismatched_byval_callee(ptr)43define void @mismatched_byval(ptr byval({ i32 }) %a) {44; CHECK: mismatched ABI impacting function attributes45 musttail call void @mismatched_byval_callee(ptr %a)46 ret void47}48 49declare void @mismatched_inreg_callee(i32 inreg)50define void @mismatched_inreg(i32 %a) {51; CHECK: mismatched ABI impacting function attributes52 musttail call void @mismatched_inreg_callee(i32 inreg %a)53 ret void54}55 56declare void @mismatched_sret_callee(ptr sret(i32))57define void @mismatched_sret(ptr %a) {58; CHECK: mismatched ABI impacting function attributes59 musttail call void @mismatched_sret_callee(ptr sret(i32) %a)60 ret void61}62 63declare void @mismatched_alignment_callee(ptr byval(i32) align 8)64define void @mismatched_alignment(ptr byval(i32) align 4 %a) {65; CHECK: mismatched ABI impacting function attributes66 musttail call void @mismatched_alignment_callee(ptr byval(i32) align 8 %a)67 ret void68}69 70declare i32 @not_tail_pos_callee()71define i32 @not_tail_pos() {72; CHECK: musttail call must precede a ret with an optional bitcast73 %v = musttail call i32 @not_tail_pos_callee()74 %w = add i32 %v, 175 ret i32 %w76}77 78define void @inline_asm() {79; CHECK: cannot use musttail call with inline asm80 musttail call void asm "ret", ""()81 ret void82}83