Home | History | Annotate | Download | only in Verifier
      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
      7 !0 = metadata !{ i32 1 }
      8 ; CHECK: invalid behavior operand in module flag (expected constant integer)
      9 ; CHECK: metadata !"foo"
     10 !1 = metadata !{ metadata !"foo", metadata !"foo", i32 42 }
     11 ; CHECK: invalid behavior operand in module flag (unexpected constant)
     12 ; CHECK: i32 999
     13 !2 = metadata !{ i32 999, metadata !"foo", i32 43 }
     14 ; CHECK: invalid ID operand in module flag (expected metadata string)
     15 ; CHECK: i32 1
     16 !3 = metadata !{ i32 1, i32 1, i32 44 }
     17 ; CHECK: invalid value for 'require' module flag (expected metadata pair)
     18 ; CHECK: i32 45
     19 !4 = metadata !{ i32 3, metadata !"bla", i32 45 }
     20 ; CHECK: invalid value for 'require' module flag (expected metadata pair)
     21 ; CHECK: metadata !
     22 !5 = metadata !{ i32 3, metadata !"bla", metadata !{ i32 46 } }
     23 ; CHECK: invalid value for 'require' module flag (first value operand should be a string)
     24 ; CHECK: i32 47
     25 !6 = metadata !{ i32 3, metadata !"bla", metadata !{ i32 47, i32 48 } }
     26 
     27 ; Check that module flags only have unique IDs.
     28 ;
     29 ; CHECK: module flag identifiers must be unique (or of 'require' type)
     30 !7 = metadata !{ i32 1, metadata !"foo", i32 49 }
     31 !8 = metadata !{ i32 2, metadata !"foo", i32 50 }
     32 ; CHECK-NOT: module flag identifiers must be unique
     33 !9 = metadata !{ i32 2, metadata !"bar", i32 51 }
     34 !10 = metadata !{ i32 3, metadata !"bar", metadata !{ metadata !"bar", i32 51 } }
     35 
     36 ; Check that any 'append'-type module flags are valid.
     37 ; CHECK: invalid value for 'append'-type module flag (expected a metadata node)
     38 !16 = metadata !{ i32 5, metadata !"flag-2", i32 56 }
     39 ; CHECK: invalid value for 'append'-type module flag (expected a metadata node)
     40 !17 = metadata !{ i32 5, metadata !"flag-3", i32 57 }
     41 ; CHECK-NOT: invalid value for 'append'-type module flag (expected a metadata node)
     42 !18 = metadata !{ i32 5, metadata !"flag-4", metadata !{ i32 57 } }
     43 
     44 ; Check that any 'require' module flags are valid.
     45 ; CHECK: invalid requirement on flag, flag is not present in module
     46 !11 = metadata !{ i32 3, metadata !"bar",
     47      metadata !{ metadata !"no-such-flag", i32 52 } }
     48 ; CHECK: invalid requirement on flag, flag does not have the required value
     49 !12 = metadata !{ i32 1, metadata !"flag-0", i32 53 }
     50 !13 = metadata !{ i32 3, metadata !"bar",
     51      metadata !{ metadata !"flag-0", i32 54 } }
     52 ; CHECK-NOT: invalid requirement on flag, flag is not present in module
     53 ; CHECK-NOT: invalid requirement on flag, flag does not have the required value
     54 !14 = metadata !{ i32 1, metadata !"flag-1", i32 55 }
     55 !15 = metadata !{ i32 3, metadata !"bar",
     56      metadata !{ metadata !"flag-1", i32 55 } }
     57 
     58 !llvm.module.flags = !{
     59   !0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15,
     60   !16, !17, !18 }
     61