Home | History | Annotate | Download | only in Verifier
      1 ; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
      2 
      3 define void @f1(i8* %x) {
      4 entry:
      5   store i8 0, i8* %x, align 1, !range !0
      6   ret void
      7 }
      8 !0 = metadata !{i8 0, i8 1}
      9 ; CHECK: Ranges are only for loads, calls and invokes!
     10 ; CHECK-NEXT: store i8 0, i8* %x, align 1, !range !0
     11 
     12 define i8 @f2(i8* %x) {
     13 entry:
     14   %y = load i8* %x, align 1, !range !1
     15   ret i8 %y
     16 }
     17 !1 = metadata !{}
     18 ; CHECK: It should have at least one range!
     19 ; CHECK-NEXT: metadata
     20 
     21 define i8 @f3(i8* %x) {
     22 entry:
     23   %y = load i8* %x, align 1, !range !2
     24   ret i8 %y
     25 }
     26 !2 = metadata !{i8 0}
     27 ; CHECK: Unfinished range!
     28 
     29 define i8 @f4(i8* %x) {
     30 entry:
     31   %y = load i8* %x, align 1, !range !3
     32   ret i8 %y
     33 }
     34 !3 = metadata !{double 0.0, i8 0}
     35 ; CHECK: The lower limit must be an integer!
     36 
     37 define i8 @f5(i8* %x) {
     38 entry:
     39   %y = load i8* %x, align 1, !range !4
     40   ret i8 %y
     41 }
     42 !4 = metadata !{i8 0, double 0.0}
     43 ; CHECK: The upper limit must be an integer!
     44 
     45 define i8 @f6(i8* %x) {
     46 entry:
     47   %y = load i8* %x, align 1, !range !5
     48   ret i8 %y
     49 }
     50 !5 = metadata !{i32 0, i8 0}
     51 ; CHECK: Range types must match load type!
     52 ; CHECK:  %y = load
     53 
     54 define i8 @f7(i8* %x) {
     55 entry:
     56   %y = load i8* %x, align 1, !range !6
     57   ret i8 %y
     58 }
     59 !6 = metadata !{i8 0, i32 0}
     60 ; CHECK: Range types must match load type!
     61 ; CHECK:  %y = load
     62 
     63 define i8 @f8(i8* %x) {
     64 entry:
     65   %y = load i8* %x, align 1, !range !7
     66   ret i8 %y
     67 }
     68 !7 = metadata !{i32 0, i32 0}
     69 ; CHECK: Range types must match load type!
     70 ; CHECK:  %y = load
     71 
     72 define i8 @f9(i8* %x) {
     73 entry:
     74   %y = load i8* %x, align 1, !range !8
     75   ret i8 %y
     76 }
     77 !8 = metadata !{i8 0, i8 0}
     78 ; CHECK: Range must not be empty!
     79 
     80 define i8 @f10(i8* %x) {
     81 entry:
     82   %y = load i8* %x, align 1, !range !9
     83   ret i8 %y
     84 }
     85 !9 = metadata !{i8 0, i8 2, i8 1, i8 3}
     86 ; CHECK: Intervals are overlapping
     87 
     88 define i8 @f11(i8* %x) {
     89 entry:
     90   %y = load i8* %x, align 1, !range !10
     91   ret i8 %y
     92 }
     93 !10 = metadata !{i8 0, i8 2, i8 2, i8 3}
     94 ; CHECK: Intervals are contiguous
     95 
     96 define i8 @f12(i8* %x) {
     97 entry:
     98   %y = load i8* %x, align 1, !range !11
     99   ret i8 %y
    100 }
    101 !11 = metadata !{i8 1, i8 2, i8 -1, i8 0}
    102 ; CHECK: Intervals are not in order
    103 
    104 define i8 @f13(i8* %x) {
    105 entry:
    106   %y = load i8* %x, align 1, !range !12
    107   ret i8 %y
    108 }
    109 !12 = metadata !{i8 1, i8 3, i8 5, i8 1}
    110 ; CHECK: Intervals are contiguous
    111 
    112 define i8 @f14(i8* %x) {
    113 entry:
    114   %y = load i8* %x, align 1, !range !13
    115   ret i8 %y
    116 }
    117 !13 = metadata !{i8 1, i8 3, i8 5, i8 2}
    118 ; CHECK: Intervals are overlapping
    119 
    120 define i8 @f15(i8* %x) {
    121 entry:
    122   %y = load i8* %x, align 1, !range !14
    123   ret i8 %y
    124 }
    125 !14 = metadata !{i8 10, i8 1, i8 12, i8 13}
    126 ; CHECK: Intervals are overlapping
    127 
    128 define i8 @f16(i8* %x) {
    129 entry:
    130   %y = load i8* %x, align 1, !range !16
    131   ret i8 %y
    132 }
    133 !16 = metadata !{i8 1, i8 3, i8 4, i8 5, i8 6, i8 2}
    134 ; CHECK: Intervals are overlapping
    135 
    136 define i8 @f17(i8* %x) {
    137 entry:
    138   %y = load i8* %x, align 1, !range !17
    139   ret i8 %y
    140 }
    141 !17 = metadata !{i8 1, i8 3, i8 4, i8 5, i8 6, i8 1}
    142 ; CHECK: Intervals are contiguous
    143