about summary refs log tree commit diff homepage
path: root/test
diff options
context:
space:
mode:
authorLei Zhang <antiAgainst@gmail.com>2013-09-04 17:38:12 -0400
committerLei Zhang <antiAgainst@gmail.com>2013-09-23 16:57:21 -0400
commitfc29e256039d1af4979fd0a5c7170de84b19818b (patch)
tree962e05f3c908ef7584836c668576b274d027d8c2 /test
parent95521073b1a6c0eec2719a4c355c83506b325693 (diff)
downloadklee-fc29e256039d1af4979fd0a5c7170de84b19818b.tar.gz
Lower intrinsic instruction "llvm.trap" to a call of the abort() function.
Diffstat (limited to 'test')
-rw-r--r--test/Feature/IntrinsicTrap.ll28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/Feature/IntrinsicTrap.ll b/test/Feature/IntrinsicTrap.ll
new file mode 100644
index 00000000..5af46225
--- /dev/null
+++ b/test/Feature/IntrinsicTrap.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as %s -f -o %t1.bc
+; RUN: %klee -disable-opt %t1.bc
+; RUN: grep abort() klee-last/assembly.ll | wc -l | grep -q 2
+; RUN: echo "llvm.trap()" > %t2.ll
+; RUN: grep llvm.trap() klee-last/assembly.ll %t2.ll | wc -l | grep -q 1
+
+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-f128:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @main() nounwind {
+entry:
+  %a = add i32 1, 2
+  %b = add i32 %a, 3
+  %c = icmp ne i32 %b, 6
+  br i1 %c, label %btrue, label %bfalse
+
+btrue:
+  call void @llvm.trap() noreturn nounwind
+  unreachable
+
+bfalse:
+  br label %return
+
+return:
+  ret i32 0
+}
+
+declare void @llvm.trap() noreturn nounwind