aboutsummaryrefslogtreecommitdiff
path: root/test/Verifier
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-03-24 00:14:51 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-03-24 00:14:51 +0000
commit39dd328ed0892e063d02768336c4b792c925cdc3 (patch)
treeaa22c2c837d8e0dd7d4cc7747d37d37f2235bd73 /test/Verifier
parent1db394921b9635980555cc8d7e0d05b5e885784f (diff)
First part of PR12251. Add documentation and verifier support for the range
metadata. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153359 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Verifier')
-rw-r--r--test/Verifier/range-1.ll78
-rw-r--r--test/Verifier/range-2.ll22
2 files changed, 100 insertions, 0 deletions
diff --git a/test/Verifier/range-1.ll b/test/Verifier/range-1.ll
new file mode 100644
index 0000000000..611933a1ec
--- /dev/null
+++ b/test/Verifier/range-1.ll
@@ -0,0 +1,78 @@
+; RUN: not llvm-as < %s -o /dev/null |& FileCheck %s
+
+define void @f1(i8* %x) {
+entry:
+ store i8 0, i8* %x, align 1, !range !0
+ ret void
+}
+!0 = metadata !{i8 0, i8 1}
+; CHECK: Ranges are only for loads!
+; CHECK-NEXT: store i8 0, i8* %x, align 1, !range !0
+
+define i8 @f2(i8* %x) {
+entry:
+ %y = load i8* %x, align 1, !range !1
+ ret i8 %y
+}
+!1 = metadata !{}
+; CHECK: It should have at least one range!
+; CHECK-NEXT: metadata
+
+define i8 @f3(i8* %x) {
+entry:
+ %y = load i8* %x, align 1, !range !2
+ ret i8 %y
+}
+!2 = metadata !{i8 0}
+; CHECK: Unfinished range!
+
+define i8 @f4(i8* %x) {
+entry:
+ %y = load i8* %x, align 1, !range !3
+ ret i8 %y
+}
+!3 = metadata !{double 0.0, i8 0}
+; CHECK: The lower limit must be an integer!
+
+define i8 @f5(i8* %x) {
+entry:
+ %y = load i8* %x, align 1, !range !4
+ ret i8 %y
+}
+!4 = metadata !{i8 0, double 0.0}
+; CHECK: The upper limit must be an integer!
+
+define i8 @f6(i8* %x) {
+entry:
+ %y = load i8* %x, align 1, !range !5
+ ret i8 %y
+}
+!5 = metadata !{i32 0, i8 0}
+; CHECK: Range types must match load type!
+; CHECK: %y = load
+
+define i8 @f7(i8* %x) {
+entry:
+ %y = load i8* %x, align 1, !range !6
+ ret i8 %y
+}
+!6 = metadata !{i8 0, i32 0}
+; CHECK: Range types must match load type!
+; CHECK: %y = load
+
+define i8 @f8(i8* %x) {
+entry:
+ %y = load i8* %x, align 1, !range !7
+ ret i8 %y
+}
+!7 = metadata !{i32 0, i32 0}
+; CHECK: Range types must match load type!
+; CHECK: %y = load
+
+define i8 @f9(i8* %x) {
+entry:
+ %y = load i8* %x, align 1, !range !8
+ ret i8 %y
+}
+!8 = metadata !{i8 0, i8 0}
+; CHECK: Range must not be empty!
diff --git a/test/Verifier/range-2.ll b/test/Verifier/range-2.ll
new file mode 100644
index 0000000000..ef542c8c93
--- /dev/null
+++ b/test/Verifier/range-2.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s -o /dev/null
+
+define i8 @f1(i8* %x) {
+entry:
+ %y = load i8* %x, align 1, !range !0
+ ret i8 %y
+}
+!0 = metadata !{i8 0, i8 1}
+
+define i8 @f2(i8* %x) {
+entry:
+ %y = load i8* %x, align 1, !range !1
+ ret i8 %y
+}
+!1 = metadata !{i8 255, i8 1}
+
+define i8 @f3(i8* %x) {
+entry:
+ %y = load i8* %x, align 1, !range !2
+ ret i8 %y
+}
+!2 = metadata !{i8 1, i8 3, i8 5, i8 42}