1; RUN: opt < %s -passes=lint -disable-output 2>&1 | FileCheck %s 2 3declare void @fn_nothing_i8(i8 %x) 4declare void @fn_zeroext(i8 zeroext %x) 5declare void @fn_signext(i8 signext %x) 6declare void @fn_inreg(i8 inreg %x) 7 8declare void @fn_nothing_ptr(ptr %x) 9declare void @fn_byval(ptr byval(i8) %x) 10declare void @fn_byref(ptr byref(i8) %x) 11declare void @fn_inalloca(ptr inalloca(i8) %x) 12declare void @fn_preallocated(ptr preallocated(i8) %x) 13declare void @fn_sret(ptr sret(i8) %x) 14 15define void @caller_zeroext(i8 %x) { 16; CHECK: Undefined behavior: ABI attribute zeroext not present on both function and call-site 17; CHECK: call void @fn_zeroext(i8 %x) 18 call void @fn_zeroext(i8 %x) 19 20; CHECK: Undefined behavior: ABI attribute zeroext not present on both function and call-site 21; CHECK: call void @fn_nothing_i8(i8 zeroext %x) 22 call void @fn_nothing_i8(i8 zeroext %x) 23 ret void 24} 25 26define void @caller_signext(i8 %x) { 27; CHECK: Undefined behavior: ABI attribute signext not present on both function and call-site 28; CHECK: call void @fn_signext(i8 %x) 29 call void @fn_signext(i8 %x) 30 31; CHECK: Undefined behavior: ABI attribute signext not present on both function and call-site 32; CHECK: call void @fn_nothing_i8(i8 signext %x) 33 call void @fn_nothing_i8(i8 signext %x) 34 ret void 35} 36 37define void @caller_inreg(i8 %x) { 38; CHECK: Undefined behavior: ABI attribute inreg not present on both function and call-site 39; CHECK: call void @fn_inreg(i8 %x) 40 call void @fn_inreg(i8 %x) 41 42; CHECK: Undefined behavior: ABI attribute inreg not present on both function and call-site 43; CHECK: call void @fn_nothing_i8(i8 inreg %x) 44 call void @fn_nothing_i8(i8 inreg %x) 45 ret void 46} 47 48define void @caller_byval(ptr %x) { 49; CHECK: Undefined behavior: ABI attribute byval not present on both function and call-site 50; CHECK: call void @fn_byval(ptr %x) 51 call void @fn_byval(ptr %x) 52 53; CHECK: Undefined behavior: ABI attribute byval not present on both function and call-site 54; CHECK: call void @fn_nothing_ptr(ptr byval(i8) %x) 55 call void @fn_nothing_ptr(ptr byval(i8) %x) 56 57; CHECK: Undefined behavior: ABI attribute byval does not have same argument for function and call-site 58; CHECK: call void @fn_byval(ptr byval(i16) %x) 59 call void @fn_byval(ptr byval(i16) %x) 60 ret void 61} 62 63define void @caller_byref(ptr %x) { 64; CHECK: Undefined behavior: ABI attribute byref not present on both function and call-site 65; CHECK: call void @fn_byref(ptr %x) 66 call void @fn_byref(ptr %x) 67 68; CHECK: Undefined behavior: ABI attribute byref not present on both function and call-site 69; CHECK: call void @fn_nothing_ptr(ptr byref(i8) %x) 70 call void @fn_nothing_ptr(ptr byref(i8) %x) 71 72; CHECK: Undefined behavior: ABI attribute byref does not have same argument for function and call-site 73; CHECK: call void @fn_byref(ptr byref(i16) %x) 74 call void @fn_byref(ptr byref(i16) %x) 75 ret void 76} 77 78define void @caller_inalloca(ptr %x) { 79; CHECK: Undefined behavior: ABI attribute inalloca not present on both function and call-site 80; CHECK: call void @fn_inalloca(ptr %x) 81 call void @fn_inalloca(ptr %x) 82 83; CHECK: Undefined behavior: ABI attribute inalloca not present on both function and call-site 84; CHECK: call void @fn_nothing_ptr(ptr inalloca(i8) %x) 85 call void @fn_nothing_ptr(ptr inalloca(i8) %x) 86 87; CHECK: Undefined behavior: ABI attribute inalloca does not have same argument for function and call-site 88; CHECK: call void @fn_inalloca(ptr inalloca(i16) %x) 89 call void @fn_inalloca(ptr inalloca(i16) %x) 90 ret void 91} 92 93define void @caller_sret(ptr %x) { 94; CHECK: Undefined behavior: ABI attribute sret not present on both function and call-site 95; CHECK: call void @fn_sret(ptr %x) 96 call void @fn_sret(ptr %x) 97 98; CHECK: Undefined behavior: ABI attribute sret not present on both function and call-site 99; CHECK: call void @fn_nothing_ptr(ptr sret(i8) %x) 100 call void @fn_nothing_ptr(ptr sret(i8) %x) 101 102; CHECK: Undefined behavior: ABI attribute sret does not have same argument for function and call-site 103; CHECK: call void @fn_sret(ptr sret(i16) %x) 104 call void @fn_sret(ptr sret(i16) %x) 105 ret void 106} 107