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