1; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s 2 3declare i8* @foo() 4 5define void @f1() { 6entry: 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 13define void @f2() { 14entry: 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 21define i8 @f3(i8* %x) { 22entry: 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 29define i8 @f4(i8* %x) { 30entry: 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 37define i8* @f5(i8** %x) { 38entry: 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 46define i8* @f6(i8** %x) { 47entry: 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 54define i8* @f7(i8** %x) { 55entry: 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 63define i8* @f8(i8** %x) { 64entry: 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 71define i8* @f9(i8** %x) { 72entry: 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 80define i8* @f10(i8** %x) { 81entry: 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