blob: ff82c2845235a50f8257af84bbab29d50d6b9356 [file] [log] [blame]
Daniel Dunbar8dd938e2013-01-15 01:22:53 +00001; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
2
3; Check that module flags are structurally correct.
4;
5; CHECK: incorrect number of operands in module flag
Duncan P. N. Exon Smith02a8d1b2014-12-16 07:40:31 +00006; CHECK: !0
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +00007!0 = !{i32 1}
Daniel Dunbar8dd938e2013-01-15 01:22:53 +00008; CHECK: invalid behavior operand in module flag (expected constant integer)
Duncan P. N. Exon Smith02a8d1b2014-12-16 07:40:31 +00009; CHECK: !"foo"
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000010!1 = !{!"foo", !"foo", i32 42}
Daniel Dunbar8dd938e2013-01-15 01:22:53 +000011; CHECK: invalid behavior operand in module flag (unexpected constant)
12; CHECK: i32 999
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000013!2 = !{i32 999, !"foo", i32 43}
Daniel Dunbar8dd938e2013-01-15 01:22:53 +000014; CHECK: invalid ID operand in module flag (expected metadata string)
15; CHECK: i32 1
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000016!3 = !{i32 1, i32 1, i32 44}
Daniel Dunbar8dd938e2013-01-15 01:22:53 +000017; CHECK: invalid value for 'require' module flag (expected metadata pair)
18; CHECK: i32 45
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000019!4 = !{i32 3, !"bla", i32 45}
Daniel Dunbar8dd938e2013-01-15 01:22:53 +000020; CHECK: invalid value for 'require' module flag (expected metadata pair)
Duncan P. N. Exon Smith02a8d1b2014-12-16 07:40:31 +000021; CHECK: !
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000022!5 = !{i32 3, !"bla", !{i32 46}}
Daniel Dunbar8dd938e2013-01-15 01:22:53 +000023; CHECK: invalid value for 'require' module flag (first value operand should be a string)
24; CHECK: i32 47
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000025!6 = !{i32 3, !"bla", !{i32 47, i32 48}}
Daniel Dunbar8dd938e2013-01-15 01:22:53 +000026
27; Check that module flags only have unique IDs.
28;
29; CHECK: module flag identifiers must be unique (or of 'require' type)
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000030!7 = !{i32 1, !"foo", i32 49}
31!8 = !{i32 2, !"foo", i32 50}
Daniel Dunbar8dd938e2013-01-15 01:22:53 +000032; CHECK-NOT: module flag identifiers must be unique
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000033!9 = !{i32 2, !"bar", i32 51}
34!10 = !{i32 3, !"bar", !{!"bar", i32 51}}
Daniel Dunbar12bfff42013-01-15 20:52:06 +000035
Daniel Dunbar5db391c2013-01-16 21:38:56 +000036; Check that any 'append'-type module flags are valid.
37; CHECK: invalid value for 'append'-type module flag (expected a metadata node)
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000038!16 = !{i32 5, !"flag-2", i32 56}
Daniel Dunbar5db391c2013-01-16 21:38:56 +000039; CHECK: invalid value for 'append'-type module flag (expected a metadata node)
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000040!17 = !{i32 5, !"flag-3", i32 57}
Daniel Dunbar5db391c2013-01-16 21:38:56 +000041; CHECK-NOT: invalid value for 'append'-type module flag (expected a metadata node)
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000042!18 = !{i32 5, !"flag-4", !{i32 57}}
Daniel Dunbar5db391c2013-01-16 21:38:56 +000043
Teresa Johnson1fd5bb92017-05-23 00:08:00 +000044; Check that any 'max' module flags are valid.
45; CHECK: invalid value for 'max' module flag (expected constant integer)
46!19 = !{i32 7, !"max", !"max"}
47
Daniel Dunbar12bfff42013-01-15 20:52:06 +000048; Check that any 'require' module flags are valid.
49; CHECK: invalid requirement on flag, flag is not present in module
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000050!11 = !{i32 3, !"bar", !{!"no-such-flag", i32 52}}
Daniel Dunbar12bfff42013-01-15 20:52:06 +000051; CHECK: invalid requirement on flag, flag does not have the required value
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000052!12 = !{i32 1, !"flag-0", i32 53}
53!13 = !{i32 3, !"bar", !{!"flag-0", i32 54}}
Daniel Dunbar12bfff42013-01-15 20:52:06 +000054; CHECK-NOT: invalid requirement on flag, flag is not present in module
55; CHECK-NOT: invalid requirement on flag, flag does not have the required value
Duncan P. N. Exon Smith1ef70ff2014-12-15 19:07:53 +000056!14 = !{i32 1, !"flag-1", i32 55}
57!15 = !{i32 3, !"bar", !{!"flag-1", i32 55}}
Daniel Dunbar8dd938e2013-01-15 01:22:53 +000058
59!llvm.module.flags = !{
Daniel Dunbar5db391c2013-01-16 21:38:56 +000060 !0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15,
Teresa Johnson1fd5bb92017-05-23 00:08:00 +000061 !16, !17, !18, !19 }