1 ; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
3 ; Each musttail call should fail to validate.
5 declare x86_stdcallcc void @cc_mismatch_callee()
6 define void @cc_mismatch() {
7 ; CHECK: mismatched calling conv
8 musttail call x86_stdcallcc void @cc_mismatch_callee()
12 declare void @more_parms_callee(i32)
13 define void @more_parms() {
14 ; CHECK: mismatched parameter counts
15 musttail call void @more_parms_callee(i32 0)
19 declare void @mismatched_intty_callee(i8)
20 define void @mismatched_intty(i32) {
21 ; CHECK: mismatched parameter types
22 musttail call void @mismatched_intty_callee(i8 0)
26 declare void @mismatched_vararg_callee(ptr, ...)
27 define void @mismatched_vararg(ptr) {
28 ; CHECK: mismatched varargs
29 musttail call void (ptr, ...) @mismatched_vararg_callee(ptr null)
33 ; We would make this an implicit sret parameter, which would disturb the
35 declare { i32, i32, i32 } @mismatched_retty_callee(i32)
36 define void @mismatched_retty(i32) {
37 ; CHECK: mismatched return types
38 musttail call { i32, i32, i32 } @mismatched_retty_callee(i32 0)
42 declare void @mismatched_byval_callee(ptr)
43 define void @mismatched_byval(ptr byval({ i32 }) %a) {
44 ; CHECK: mismatched ABI impacting function attributes
45 musttail call void @mismatched_byval_callee(ptr %a)
49 declare void @mismatched_inreg_callee(i32 inreg)
50 define void @mismatched_inreg(i32 %a) {
51 ; CHECK: mismatched ABI impacting function attributes
52 musttail call void @mismatched_inreg_callee(i32 inreg %a)
56 declare void @mismatched_sret_callee(ptr sret(i32))
57 define void @mismatched_sret(ptr %a) {
58 ; CHECK: mismatched ABI impacting function attributes
59 musttail call void @mismatched_sret_callee(ptr sret(i32) %a)
63 declare void @mismatched_alignment_callee(ptr byval(i32) align 8)
64 define void @mismatched_alignment(ptr byval(i32) align 4 %a) {
65 ; CHECK: mismatched ABI impacting function attributes
66 musttail call void @mismatched_alignment_callee(ptr byval(i32) align 8 %a)
70 declare i32 @not_tail_pos_callee()
71 define i32 @not_tail_pos() {
72 ; CHECK: musttail call must precede a ret with an optional bitcast
73 %v = musttail call i32 @not_tail_pos_callee()
78 define void @inline_asm() {
79 ; CHECK: cannot use musttail call with inline asm
80 musttail call void asm "ret", ""()