blob: 6c6b9d1c53d91e445e73467ca5782bfd748bc0cd [file] [log] [blame]
Sanjoy Das3336f682016-12-11 20:07:15 +00001; RUN: not llvm-as < %s 2>&1 | FileCheck %s
2
3define void @f_0(i32* %ptr) {
4; This part checks for the easy syntactic verifier rules.
5
6; CHECK: Struct tag metadata must have either 3 or 4 operands
7; CHECK-NEXT: store i32 0, i32* %ptr, !tbaa !{{[0-9]+}}
8
9; CHECK: Immutability tag on struct tag metadata must be a constant
10; CHECK-NEXT: store i32 1, i32* %ptr, !tbaa !{{[0-9]+}}
11
12; CHECK: Immutability part of the struct tag metadata must be either 0 or 1
13; CHECK-NEXT: store i32 2, i32* %ptr, !tbaa !{{[0-9]+}}
14
15; CHECK: Offset must be constant integer
16; CHECK-NEXT: store i32 3, i32* %ptr, !tbaa !{{[0-9]+}}
17
18; CHECK: Malformed struct tag metadata: base and access-type should be non-null and point to Metadata nodes
19; CHECK-NEXT: store i32 4, i32* %ptr, !tbaa !{{[0-9]+}}
20
21; CHECK: Access type node must be scalar
22; CHECK-NEXT: store i32 5, i32* %ptr, !tbaa !{{[0-9]+}}
23
24; CHECK: Access bit-width not the same as description bit-width
25; CHECK-NEXT: store i32 6, i32* %ptr, !tbaa !{{[0-9]+}}
26
27; CHECK: Access type node must be scalar
28; CHECK-NEXT: store i32 7, i32* %ptr, !tbaa !{{[0-9]+}}
29
30 store i32 0, i32* %ptr, !tbaa !{!3, !2, i64 40, i64 0, i64 1, i64 2}
31 store i32 1, i32* %ptr, !tbaa !{!3, !2, i64 40, !"immutable"}
32 store i32 2, i32* %ptr, !tbaa !{!3, !2, i64 40, i64 4}
33 store i32 3, i32* %ptr, !tbaa !{!3, !2, !"40", i64 0}
34 store i32 4, i32* %ptr, !tbaa !{!3, null, !"40", i64 0}
35 store i32 5, i32* %ptr, !tbaa !{!3, !3, !"40", i64 0}
36 store i32 6, i32* %ptr, !tbaa !{!3, !2, i32 40, i64 0}
37 store i32 7, i32* %ptr, !tbaa !{!3, !12, i32 40, i64 0}
38 ret void
39}
40
41
42define void @f_1(i32* %ptr) {
43; This part checks for more semantic verifier rules.
44
45; CHECK: Cycle detected in struct path
46; CHECK-NEXT: store i32 0, i32* %ptr, !tbaa !{{[0-9]+}}
47
48; CHECK: Offset not zero at the point of scalar access
49; CHECK-NEXT: store i32 1, i32* %ptr, !tbaa !{{[0-9]+}}
50
51; CHECK: Offset not zero at the point of scalar access
52; CHECK-NEXT: store i32 2, i32* %ptr, !tbaa !{{[0-9]+}}
53
54; CHECK: Could not find TBAA parent in struct type node
55; CHECK-NEXT: store i32 3, i32* %ptr, !tbaa !{{[0-9]+}}
56
57; CHECK: Did not see access type in access path!
58; CHECK-NEXT: store i32 3, i32* %ptr, !tbaa !{{[0-9]+}}
59
60; CHECK: Invalid parent operand in scalar TBAA node
61; CHECK-NEXT: store i32 4, i32* %ptr, !tbaa !{{[0-9]+}}
62
63; CHECK: Invalid name operand in scalar TBAA node
64; CHECK-NEXT: store i32 5, i32* %ptr, !tbaa !{{[0-9]+}}
65
66; CHECK: Null operands in scalar type nodes!
67; CHECK-NEXT: store i32 6, i32* %ptr, !tbaa !{{[0-9]+}}
68
69; CHECK: Struct tag nodes must have an odd number of operands!
70; CHECK-NEXT:!{{[0-9]+}} = !{!"bad-struct-type-0", !{{[0-9]+}}, i64 40, !{{[0-9]+}}}
71
72; CHECK: Incorrect field entry in struct type node!
73; CHECK-NEXT: store i32 8, i32* %ptr, !tbaa !{{[0-9]+}}
74
75; CHECK: Bitwidth between the offsets and struct type entries must match
76; CHECK-NEXT: store i32 9, i32* %ptr, !tbaa !{{[0-9]+}}
77
78; CHECK: Offsets must be increasing!
79; CHECK-NEXT: store i32 10, i32* %ptr, !tbaa !{{[0-9]+}}
80
81 store i32 0, i32* %ptr, !tbaa !{!4, !2, i64 40}
82 store i32 1, i32* %ptr, !tbaa !{!3, !2, i64 45}
83 store i32 2, i32* %ptr, !tbaa !{!3, !2, i64 45}
84 store i32 3, i32* %ptr, !tbaa !{!3, !2, i64 10}
85 store i32 4, i32* %ptr, !tbaa !{!5, !5, i64 0}
86 store i32 5, i32* %ptr, !tbaa !{!6, !6, i64 0}
87 store i32 6, i32* %ptr, !tbaa !{!7, !7, i64 0}
88 store i32 7, i32* %ptr, !tbaa !{!8, !1, i64 40}
89 store i32 8, i32* %ptr, !tbaa !{!9, !1, i64 40}
90 store i32 9, i32* %ptr, !tbaa !{!10, !1, i64 40}
91 store i32 10, i32* %ptr, !tbaa !{!11, !1, i64 40}
92 ret void
93}
94
95
96
97!0 = !{!"root"}
98!1 = !{!"scalar-a", !0}
99!2 = !{!"scalar-b", !0}
100!3 = !{!"struct-a", !2, i64 20, !1, i64 40}
101!4 = distinct !{!"self-recursive-struct", !2, i64 20, !4, i64 40}
102!5 = !{!"bad-scalar-0", i64 40}
103!6 = !{i64 42, !0}
104!7 = !{!"bad-scalar-1", null}
105!8 = !{!"bad-struct-type-0", !1, i64 40, !1}
106!9 = !{!"bad-struct-type-1", !1, i64 40, i64 56, !1}
107!10 = !{!"bad-struct-type-2", !1, i64 40, !1, i32 56}
108!11 = !{!"bad-struct-type-2", !1, i64 80, !1, i64 56}
109!12 = !{!"bad-scalar-2", !3, i64 0}