Daniel Dunbar | 25c4b57 | 2013-01-15 01:22:53 +0000 | [diff] [blame] | 1 | ; 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 |
| 6 | ; CHECK: metadata !0 |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 7 | !0 = !{i32 1} |
Daniel Dunbar | 25c4b57 | 2013-01-15 01:22:53 +0000 | [diff] [blame] | 8 | ; CHECK: invalid behavior operand in module flag (expected constant integer) |
| 9 | ; CHECK: metadata !"foo" |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 10 | !1 = !{!"foo", !"foo", i32 42} |
Daniel Dunbar | 25c4b57 | 2013-01-15 01:22:53 +0000 | [diff] [blame] | 11 | ; CHECK: invalid behavior operand in module flag (unexpected constant) |
| 12 | ; CHECK: i32 999 |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 13 | !2 = !{i32 999, !"foo", i32 43} |
Daniel Dunbar | 25c4b57 | 2013-01-15 01:22:53 +0000 | [diff] [blame] | 14 | ; CHECK: invalid ID operand in module flag (expected metadata string) |
| 15 | ; CHECK: i32 1 |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 16 | !3 = !{i32 1, i32 1, i32 44} |
Daniel Dunbar | 25c4b57 | 2013-01-15 01:22:53 +0000 | [diff] [blame] | 17 | ; CHECK: invalid value for 'require' module flag (expected metadata pair) |
| 18 | ; CHECK: i32 45 |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 19 | !4 = !{i32 3, !"bla", i32 45} |
Daniel Dunbar | 25c4b57 | 2013-01-15 01:22:53 +0000 | [diff] [blame] | 20 | ; CHECK: invalid value for 'require' module flag (expected metadata pair) |
| 21 | ; CHECK: metadata ! |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 22 | !5 = !{i32 3, !"bla", !{i32 46}} |
Daniel Dunbar | 25c4b57 | 2013-01-15 01:22:53 +0000 | [diff] [blame] | 23 | ; CHECK: invalid value for 'require' module flag (first value operand should be a string) |
| 24 | ; CHECK: i32 47 |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 25 | !6 = !{i32 3, !"bla", !{i32 47, i32 48}} |
Daniel Dunbar | 25c4b57 | 2013-01-15 01:22:53 +0000 | [diff] [blame] | 26 | |
| 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 Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 30 | !7 = !{i32 1, !"foo", i32 49} |
| 31 | !8 = !{i32 2, !"foo", i32 50} |
Daniel Dunbar | 25c4b57 | 2013-01-15 01:22:53 +0000 | [diff] [blame] | 32 | ; CHECK-NOT: module flag identifiers must be unique |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 33 | !9 = !{i32 2, !"bar", i32 51} |
| 34 | !10 = !{i32 3, !"bar", !{!"bar", i32 51}} |
Daniel Dunbar | c36547d | 2013-01-15 20:52:06 +0000 | [diff] [blame] | 35 | |
Daniel Dunbar | d77d9fb | 2013-01-16 21:38:56 +0000 | [diff] [blame] | 36 | ; 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 Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 38 | !16 = !{i32 5, !"flag-2", i32 56} |
Daniel Dunbar | d77d9fb | 2013-01-16 21:38:56 +0000 | [diff] [blame] | 39 | ; CHECK: invalid value for 'append'-type module flag (expected a metadata node) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 40 | !17 = !{i32 5, !"flag-3", i32 57} |
Daniel Dunbar | d77d9fb | 2013-01-16 21:38:56 +0000 | [diff] [blame] | 41 | ; CHECK-NOT: invalid value for 'append'-type module flag (expected a metadata node) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 42 | !18 = !{i32 5, !"flag-4", !{i32 57}} |
Daniel Dunbar | d77d9fb | 2013-01-16 21:38:56 +0000 | [diff] [blame] | 43 | |
Daniel Dunbar | c36547d | 2013-01-15 20:52:06 +0000 | [diff] [blame] | 44 | ; Check that any 'require' module flags are valid. |
| 45 | ; CHECK: invalid requirement on flag, flag is not present in module |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 46 | !11 = !{i32 3, !"bar", !{!"no-such-flag", i32 52}} |
Daniel Dunbar | c36547d | 2013-01-15 20:52:06 +0000 | [diff] [blame] | 47 | ; CHECK: invalid requirement on flag, flag does not have the required value |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 48 | !12 = !{i32 1, !"flag-0", i32 53} |
| 49 | !13 = !{i32 3, !"bar", !{!"flag-0", i32 54}} |
Daniel Dunbar | c36547d | 2013-01-15 20:52:06 +0000 | [diff] [blame] | 50 | ; CHECK-NOT: invalid requirement on flag, flag is not present in module |
| 51 | ; CHECK-NOT: invalid requirement on flag, flag does not have the required value |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 52 | !14 = !{i32 1, !"flag-1", i32 55} |
| 53 | !15 = !{i32 3, !"bar", !{!"flag-1", i32 55}} |
Daniel Dunbar | 25c4b57 | 2013-01-15 01:22:53 +0000 | [diff] [blame] | 54 | |
| 55 | !llvm.module.flags = !{ |
Daniel Dunbar | d77d9fb | 2013-01-16 21:38:56 +0000 | [diff] [blame] | 56 | !0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15, |
| 57 | !16, !17, !18 } |