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