Home | History | Annotate | Download | only in Verifier
      1 ; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
      2 
      3 declare i8* @foo()
      4 
      5 define void @f1() {
      6 entry:
      7   call i8* @foo(), !dereferenceable !{i64 2}
      8   ret void
      9 }
     10 ; CHECK: dereferenceable, dereferenceable_or_null apply only to load instructions, use attributes for calls or invokes
     11 ; CHECK-NEXT: call i8* @foo()
     12 
     13 define void @f2() {
     14 entry:
     15   call i8* @foo(), !dereferenceable_or_null !{i64 2}
     16   ret void
     17 }
     18 ; CHECK: dereferenceable, dereferenceable_or_null apply only to load instructions, use attributes for calls or invokes
     19 ; CHECK-NEXT: call i8* @foo()
     20 
     21 define i8 @f3(i8* %x) {
     22 entry:
     23   %y = load i8, i8* %x, !dereferenceable !{i64 2}
     24   ret i8 %y
     25 }
     26 ; CHECK: dereferenceable, dereferenceable_or_null apply only to pointer types
     27 ; CHECK-NEXT: load i8, i8* %x
     28 
     29 define i8 @f4(i8* %x) {
     30 entry:
     31   %y = load i8, i8* %x, !dereferenceable_or_null !{i64 2}
     32   ret i8 %y
     33 }
     34 ; CHECK: dereferenceable, dereferenceable_or_null apply only to pointer types
     35 ; CHECK-NEXT: load i8, i8* %x
     36 
     37 define i8* @f5(i8** %x) {
     38 entry:
     39   %y = load i8*, i8** %x, !dereferenceable !{}
     40   ret i8* %y
     41 }
     42 ; CHECK: dereferenceable, dereferenceable_or_null take one operand
     43 ; CHECK-NEXT: load i8*, i8** %x
     44 
     45 
     46 define i8* @f6(i8** %x) {
     47 entry:
     48   %y = load i8*, i8** %x, !dereferenceable_or_null !{}
     49   ret i8* %y
     50 }
     51 ; CHECK: dereferenceable, dereferenceable_or_null take one operand
     52 ; CHECK-NEXT: load i8*, i8** %x
     53 
     54 define i8* @f7(i8** %x) {
     55 entry:
     56   %y = load i8*, i8** %x, !dereferenceable !{!"str"}
     57   ret i8* %y
     58 }
     59 ; CHECK: dereferenceable, dereferenceable_or_null metadata value must be an i64!
     60 ; CHECK-NEXT: load i8*, i8** %x
     61 
     62 
     63 define i8* @f8(i8** %x) {
     64 entry:
     65   %y = load i8*, i8** %x, !dereferenceable_or_null !{!"str"}
     66   ret i8* %y
     67 }
     68 ; CHECK: dereferenceable, dereferenceable_or_null metadata value must be an i64!
     69 ; CHECK-NEXT: load i8*, i8** %x
     70 
     71 define i8* @f9(i8** %x) {
     72 entry:
     73   %y = load i8*, i8** %x, !dereferenceable !{i32 2}
     74   ret i8* %y
     75 }
     76 ; CHECK: dereferenceable, dereferenceable_or_null metadata value must be an i64!
     77 ; CHECK-NEXT: load i8*, i8** %x
     78 
     79 
     80 define i8* @f10(i8** %x) {
     81 entry:
     82   %y = load i8*, i8** %x, !dereferenceable_or_null !{i32 2}
     83   ret i8* %y
     84 }
     85 ; CHECK: dereferenceable, dereferenceable_or_null metadata value must be an i64!
     86 ; CHECK-NEXT: load i8*, i8** %x