about summary refs log tree commit diff homepage
path: root/test
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2018-05-23 14:54:48 +0200
committerMartinNowack <martin.nowack@gmail.com>2018-10-26 13:31:07 +0100
commit1f1569510990a3330b6eb8e3499198294964a88e (patch)
tree28901b7fd4a7d92044f1db0cf97606e3bd15eed6 /test
parent3f70fbfc3d3b0cc2cc9263277979be256a39dd6e (diff)
downloadklee-1f1569510990a3330b6eb8e3499198294964a88e.tar.gz
llvm5: test, change objectsize
@llvm.objectsize has now three aguments, so fix the tests accordingly.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/Intrinsics/objectsize.leq49.ll38
-rw-r--r--test/Intrinsics/objectsize.ll9
2 files changed, 43 insertions, 4 deletions
diff --git a/test/Intrinsics/objectsize.leq49.ll b/test/Intrinsics/objectsize.leq49.ll
new file mode 100644
index 00000000..1d184bdf
--- /dev/null
+++ b/test/Intrinsics/objectsize.leq49.ll
@@ -0,0 +1,38 @@
+; Unfortunately LLVM 2.9 has a different suffix for the ``llvm.objectsize`` instrinsic
+; so this LLVM IR fails to verify for that version.
+;
+; LLVM 3.7 requires a type as the first argument to 'load'
+; REQUIRES: geq-llvm-3.7
+; REQUIRES: lt-llvm-5.0
+; RUN: %llvmas %s -o=%t.bc
+; RUN: rm -rf %t.klee-out
+; RUN: %klee -exit-on-error --output-dir=%t.klee-out -disable-opt %t.bc
+; ModuleID = 'objectsize.c'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @main() nounwind uwtable {
+entry:
+  %a = alloca i8*, align 8
+  %0 = load i8*, i8** %a, align 8
+  %1 = call i64 @llvm.objectsize.i64.p0i8(i8* %0, i1 true)
+  %cmp = icmp ne i64 %1, 0
+  br i1 %cmp, label %abort.block, label %continue.block
+
+continue.block:
+  %2 = load i8*, i8** %a, align 8
+  %3 = call i64 @llvm.objectsize.i64.p0i8(i8* %2, i1 false)
+  %cmp1 = icmp ne i64 %3, -1
+  br i1 %cmp1, label %abort.block, label %exit.block
+
+exit.block:
+  ret i32 0
+
+abort.block:
+  call void @abort()
+  unreachable
+}
+
+declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readnone
+
+declare void @abort() noreturn nounwind
diff --git a/test/Intrinsics/objectsize.ll b/test/Intrinsics/objectsize.ll
index 3a111f99..95070e66 100644
--- a/test/Intrinsics/objectsize.ll
+++ b/test/Intrinsics/objectsize.ll
@@ -2,7 +2,8 @@
 ; so this LLVM IR fails to verify for that version.
 ;
 ; LLVM 3.7 requires a type as the first argument to 'load'
-; REQUIRES: geq-llvm-3.7
+; LLVM 5 added nullunknown parameter to @llvm.objectsize
+; REQUIRES: geq-llvm-5.0
 ; RUN: %llvmas %s -o=%t.bc
 ; RUN: rm -rf %t.klee-out
 ; RUN: %klee -exit-on-error --output-dir=%t.klee-out -disable-opt %t.bc
@@ -14,13 +15,13 @@ define i32 @main() nounwind uwtable {
 entry:
   %a = alloca i8*, align 8
   %0 = load i8*, i8** %a, align 8
-  %1 = call i64 @llvm.objectsize.i64.p0i8(i8* %0, i1 true)
+  %1 = call i64 @llvm.objectsize.i64.p0i8(i8* %0, i1 true, i1 false)
   %cmp = icmp ne i64 %1, 0
   br i1 %cmp, label %abort.block, label %continue.block
 
 continue.block:
   %2 = load i8*, i8** %a, align 8
-  %3 = call i64 @llvm.objectsize.i64.p0i8(i8* %2, i1 false)
+  %3 = call i64 @llvm.objectsize.i64.p0i8(i8* %2, i1 false, i1 false)
   %cmp1 = icmp ne i64 %3, -1
   br i1 %cmp1, label %abort.block, label %exit.block
 
@@ -32,6 +33,6 @@ abort.block:
   unreachable
 }
 
-declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readnone
+declare i64 @llvm.objectsize.i64.p0i8(i8*, i1, i1) nounwind readnone
 
 declare void @abort() noreturn nounwind