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 and inttoptr 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 and inttoptr 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 87 88define i8* @f_11(i8 %val) { 89 %ptr = inttoptr i8 %val to i8*, !dereferenceable !{i32 2} 90 ret i8* %ptr 91} 92; CHECK: dereferenceable, dereferenceable_or_null metadata value must be an i64! 93; CHECK-NEXT: %ptr = inttoptr i8 %val to i8*, !dereferenceable !3 94 95define i8* @f_12(i8 %val) { 96 %ptr = inttoptr i8 %val to i8*, !dereferenceable_or_null !{i32 2} 97 ret i8* %ptr 98} 99; CHECK: dereferenceable, dereferenceable_or_null metadata value must be an i64! 100; CHECK-NEXT: %ptr = inttoptr i8 %val to i8*, !dereferenceable_or_null !3 101 102define i8* @f_13(i8 %val) { 103 %ptr = inttoptr i8 %val to i8*, !dereferenceable !{} 104 ret i8* %ptr 105} 106; CHECK: dereferenceable, dereferenceable_or_null take one operand 107; CHECK-NEXT: %ptr = inttoptr i8 %val to i8*, !dereferenceable !1 108 109define i8* @f_14(i8 %val) { 110 %ptr = inttoptr i8 %val to i8*, !dereferenceable_or_null !{} 111 ret i8* %ptr 112} 113; CHECK: dereferenceable, dereferenceable_or_null take one operand 114; CHECK-NEXT: %ptr = inttoptr i8 %val to i8*, !dereferenceable_or_null !1 115 116define i8* @f_15(i8 %val) { 117 %ptr = inttoptr i8 %val to i8*, !dereferenceable !{!"str"} 118 ret i8* %ptr 119} 120; CHECK: dereferenceable, dereferenceable_or_null metadata value must be an i64! 121; CHECK-NEXT: %ptr = inttoptr i8 %val to i8*, !dereferenceable !2 122 123define i8* @f_16(i8 %val) { 124 %ptr = inttoptr i8 %val to i8*, !dereferenceable_or_null !{!"str"} 125 ret i8* %ptr 126} 127; CHECK: dereferenceable, dereferenceable_or_null metadata value must be an i64! 128; CHECK-NEXT: %ptr = inttoptr i8 %val to i8*, !dereferenceable_or_null !2 129