xref: /llvm-project/llvm/test/Verifier/associated-metadata.ll (revision 87f2e9448e82bbed4ac59bb61bea03256aa5f4de)
1; RUN: not llvm-as -disable-output < %s -o /dev/null 2>&1 | FileCheck %s
2
3; CHECK: associated value must be pointer typed
4; CHECK-NEXT: ptr addrspace(1) @associated.int
5; CHECK-NEXT: !0 = !{i32 1}
6@associated.int = external addrspace(1) constant [8 x i8], !associated !0
7
8; CHECK: associated value must be pointer typed
9; CHECK-NEXT: ptr addrspace(1) @associated.float
10; CHECK-NEXT: !1 = !{float 1.000000e+00}
11@associated.float = external addrspace(1) constant [8 x i8], !associated !1
12
13; CHECK: associated metadata must have one operand
14; CHECK-NEXT: ptr addrspace(1) @associated.too.many.ops
15; CHECK-NEXT: !2 = !{ptr @gv.decl0, ptr @gv.decl1}
16@associated.too.many.ops = external addrspace(1) constant [8 x i8], !associated !2
17
18; CHECK: associated metadata must have one operand
19; CHECK-NEXT: ptr addrspace(1) @associated.empty
20; CHECK-NEXT: !3 = !{}
21@associated.empty = external addrspace(1) constant [8 x i8], !associated !3
22
23; CHECK: associated metadata must have a global value
24; CHECK-NEXT: ptr addrspace(1) @associated.null.metadata
25; CHECK-NEXT: !4 = !{null}
26@associated.null.metadata = external addrspace(1) constant [8 x i8], !associated !4
27
28; CHECK: global values should not associate to themselves
29; CHECK-NEXT: ptr @associated.self
30; CHECK-NEXT: !5 = !{ptr @associated.self}
31@associated.self = external constant [8 x i8], !associated !5
32
33; CHECK: associated metadata must be ValueAsMetadata
34; CHECK-NEXT: ptr @associated.string
35; CHECK-NEXT: !6 = !{!"string"}
36@associated.string = external constant [8 x i8], !associated !6
37
38@gv.decl0 = external constant [8 x i8]
39@gv.decl1 = external constant [8 x i8]
40
41!0 = !{i32 1}
42!1 = !{float 1.000000e+00}
43!2 = !{ptr @gv.decl0, ptr @gv.decl1}
44!3 = !{}
45!4 = !{null}
46!5 = !{ptr @associated.self}
47!6 = !{!"string"}
48