• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
2
3; CHECK: Attribute 'byref' type does not match parameter!
4; CHECK-NEXT: void (i32*)* @byref_mismatched_pointee_type0
5define void @byref_mismatched_pointee_type0(i32* byref(i8)) {
6  ret void
7}
8
9; CHECK: Attribute 'byref' type does not match parameter!
10; CHECK-NEXT: void (i8*)* @byref_mismatched_pointee_type1
11define void @byref_mismatched_pointee_type1(i8* byref(i32)) {
12  ret void
13}
14
15%opaque.ty = type opaque
16
17; CHECK: Attributes 'byval', 'byref', 'inalloca', and 'preallocated' do not support unsized types!
18; CHECK-NEXT: void (%opaque.ty*)* @byref_unsized
19define void @byref_unsized(%opaque.ty* byref(%opaque.ty)) {
20  ret void
21}
22
23; CHECK: Attributes 'byval', 'inalloca', 'preallocated', 'inreg', 'nest', 'byref', and 'sret' are incompatible!
24; CHECK-NEXT: void (i32*)* @byref_byval
25define void @byref_byval(i32* byref(i32) byval(i32)) {
26  ret void
27}
28
29; CHECK: Attributes 'byval', 'inalloca', 'preallocated', 'inreg', 'nest', 'byref', and 'sret' are incompatible!
30; CHECK-NEXT: void (i32*)* @byref_inalloca
31define void @byref_inalloca(i32* byref(i32) inalloca) {
32  ret void
33}
34
35; CHECK: Attributes 'byval', 'inalloca', 'preallocated', 'inreg', 'nest', 'byref', and 'sret' are incompatible!
36; CHECK-NEXT: void (i32*)* @byref_preallocated
37define void @byref_preallocated(i32* byref(i32) preallocated(i32)) {
38  ret void
39}
40
41; CHECK: Attributes 'byval', 'inalloca', 'preallocated', 'inreg', 'nest', 'byref', and 'sret' are incompatible!
42; CHECK-NEXT: void (i32*)* @byref_sret
43define void @byref_sret(i32* byref(i32) sret(i32)) {
44  ret void
45}
46
47; CHECK: Attributes 'byval', 'inalloca', 'preallocated', 'inreg', 'nest', 'byref', and 'sret' are incompatible!
48; CHECK-NEXT: void (i32*)* @byref_inreg
49define void @byref_inreg(i32* byref(i32) inreg) {
50  ret void
51}
52
53; CHECK: Attributes 'byval', 'inalloca', 'preallocated', 'inreg', 'nest', 'byref', and 'sret' are incompatible!
54; CHECK-NEXT: void (i32*)* @byref_nest
55define void @byref_nest(i32* byref(i32) nest) {
56  ret void
57}
58
59; CHECK: Wrong types for attribute: inalloca nest noalias nocapture nonnull readnone readonly byref(i32) byval(i32) preallocated(i32) sret(i32) align 1 dereferenceable(1) dereferenceable_or_null(1)
60; CHECK-NEXT: void (i32)* @byref_non_pointer
61define void @byref_non_pointer(i32 byref(i32)) {
62  ret void
63}
64
65define void @byref_callee([64 x i8]* byref([64 x i8])) {
66  ret void
67}
68
69define void @no_byref_callee(i8*) {
70  ret void
71}
72
73; CHECK: cannot guarantee tail call due to mismatched ABI impacting function attributes
74; CHECK-NEXT: musttail call void @byref_callee([64 x i8]* byref([64 x i8]) %cast)
75; CHECK-NEXT: i8* %ptr
76define void @musttail_byref_caller(i8* %ptr) {
77  %cast = bitcast i8* %ptr to [64 x i8]*
78  musttail call void @byref_callee([64 x i8]* byref([64 x i8]) %cast)
79  ret void
80}
81
82; CHECK: cannot guarantee tail call due to mismatched ABI impacting function attributes
83; CHECK-NEXT: musttail call void @byref_callee([64 x i8]* %ptr)
84; CHECK-NEXT: [64 x i8]* %ptr
85define void @musttail_byref_callee([64 x i8]* byref([64 x i8]) %ptr) {
86  musttail call void @byref_callee([64 x i8]* %ptr)
87  ret void
88}
89
90define void @byref_callee_align32(i8* byref([64 x i8]) align 32) {
91  ret void
92}
93
94; CHECK: cannot guarantee tail call due to mismatched ABI impacting function attributes
95; CHECK-NEXT: musttail call void @byref_callee_align32(i8* byref([64 x i8]) align 32 %ptr)
96; CHECK-NEXT: i8* %ptr
97define void @musttail_byref_caller_mismatched_align(i8* byref([64 x i8]) align 16 %ptr) {
98  musttail call void @byref_callee_align32(i8* byref([64 x i8]) align 32 %ptr)
99  ret void
100}
101