1 ; RUN: not llvm-as < %s 2>&1 | FileCheck %s
2 ; RUN: llvm-as -disable-verify < %s | opt -passes=verify -S | FileCheck %s --check-prefix=STRIP
6 ; STRIP: Do no strip this
7 define void @f_0(ptr %ptr) {
8 ; This part checks for the easy syntactic verifier rules.
10 ; CHECK: Struct tag metadata must have either 3 or 4 operands
11 ; CHECK-NEXT: store i32 0, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
13 ; CHECK: Immutability tag on struct tag metadata must be a constant
14 ; CHECK-NEXT: store i32 1, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
16 ; CHECK: Immutability part of the struct tag metadata must be either 0 or 1
17 ; CHECK-NEXT: store i32 2, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
19 ; CHECK: Offset must be constant integer
20 ; CHECK-NEXT: store i32 3, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
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, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
25 ; CHECK: Access type node must be a valid scalar type
26 ; CHECK-NEXT: store i32 5, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
28 ; CHECK: Access bit-width not the same as description bit-width
29 ; CHECK-NEXT: store i32 6, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
31 ; CHECK: Access type node must be a valid scalar type
32 ; CHECK-NEXT: store i32 7, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
34 ; CHECK: Struct tag nodes have a string as their first operand
35 ; CHECK-NEXT: !{{[0-9]+}} = !{!{{[0-9]+}}, !{{[0-9]+}}, i64 0}
37 ; CHECK: Access type node must be a valid scalar type
38 ; CHECK-NEXT: store i32 9, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
40 ; CHECK: TBAA metadata cannot have 0 operands
41 ; CHECK-NEXT: store i32 10, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
43 store i32 0, ptr %ptr, !tbaa !{!3, !2, i64 40, i64 0, i64 1, i64 2}
44 store i32 1, ptr %ptr, !tbaa !{!3, !2, i64 40, !"immutable"}
45 store i32 2, ptr %ptr, !tbaa !{!3, !2, i64 40, i64 4}
46 store i32 3, ptr %ptr, !tbaa !{!3, !2, !"40", i64 0}
47 store i32 4, ptr %ptr, !tbaa !{!3, null, !"40", i64 0}
48 store i32 5, ptr %ptr, !tbaa !{!3, !3, !"40", i64 0}
49 store i32 6, ptr %ptr, !tbaa !{!3, !2, i32 40, i64 0}
50 store i32 7, ptr %ptr, !tbaa !{!3, !12, i32 40, i64 0}, !metadata !42
51 store i32 8, ptr %ptr, !tbaa !{!13, !1, i64 0}
52 store i32 9, ptr %ptr, !tbaa !{!14, !14, i64 0}
53 store i32 10, ptr %ptr, !tbaa !15
56 !42 = !{!"Do no strip this!"}
58 define void @f_1(ptr %ptr) {
59 ; This part checks for more semantic verifier rules.
61 ; CHECK: Cycle detected in struct path
62 ; CHECK-NEXT: store i32 0, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
64 ; CHECK: Offset not zero at the point of scalar access
65 ; CHECK-NEXT: store i32 1, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
67 ; CHECK: Offset not zero at the point of scalar access
68 ; CHECK-NEXT: store i32 2, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
70 ; CHECK: Could not find TBAA parent in struct type node
71 ; CHECK-NEXT: store i32 3, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
73 ; CHECK: Did not see access type in access path!
74 ; CHECK-NEXT: store i32 3, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
76 ; CHECK: Access type node must be a valid scalar type
77 ; CHECK-NEXT: store i32 4, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
79 ; CHECK: Access type node must be a valid scalar type
80 ; CHECK-NEXT: store i32 5, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
82 ; CHECK: Access type node must be a valid scalar type
83 ; CHECK-NEXT: store i32 6, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
85 ; CHECK: Struct tag nodes must have an odd number of operands!
86 ; CHECK-NEXT:!{{[0-9]+}} = !{!"bad-struct-type-0", !{{[0-9]+}}, i64 40, !{{[0-9]+}}}
88 ; CHECK: Incorrect field entry in struct type node!
89 ; CHECK-NEXT: store i32 8, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
91 ; CHECK: Bitwidth between the offsets and struct type entries must match
92 ; CHECK-NEXT: store i32 9, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
94 ; CHECK: Offsets must be increasing!
95 ; CHECK-NEXT: store i32 10, ptr %ptr, align 4, !tbaa !{{[0-9]+}}
97 store i32 0, ptr %ptr, !tbaa !{!4, !2, i64 40}
98 store i32 1, ptr %ptr, !tbaa !{!3, !2, i64 45}
99 store i32 2, ptr %ptr, !tbaa !{!3, !2, i64 45}
100 store i32 3, ptr %ptr, !tbaa !{!3, !2, i64 10}
101 store i32 4, ptr %ptr, !tbaa !{!5, !5, i64 0}
102 store i32 5, ptr %ptr, !tbaa !{!6, !6, i64 0}
103 store i32 6, ptr %ptr, !tbaa !{!7, !7, i64 0}
104 store i32 7, ptr %ptr, !tbaa !{!8, !1, i64 40}
105 store i32 8, ptr %ptr, !tbaa !{!9, !1, i64 40}
106 store i32 9, ptr %ptr, !tbaa !{!10, !1, i64 40}
107 store i32 10, ptr %ptr, !tbaa !{!11, !1, i64 40}
114 !1 = !{!"scalar-a", !0}
115 !2 = !{!"scalar-b", !0}
116 !3 = !{!"struct-a", !2, i64 20, !1, i64 40}
117 !4 = distinct !{!"self-recursive-struct", !2, i64 20, !4, i64 40}
118 !5 = !{!"bad-scalar-0", i64 40}
120 !7 = !{!"bad-scalar-1", null}
121 !8 = !{!"bad-struct-type-0", !1, i64 40, !1}
122 !9 = !{!"bad-struct-type-1", !1, i64 40, i64 56, !1}
123 !10 = !{!"bad-struct-type-2", !1, i64 40, !1, i32 56}
124 !11 = !{!"bad-struct-type-2", !1, i64 80, !1, i64 56}
125 !12 = !{!"bad-scalar-2", !3, i64 0}
126 !13 = !{!1, !1, i64 0}
127 !14 = !{!"bad-scalar-2", !13}