about summary refs log tree commit diff homepage
path: root/test/regression/2008-02-11-phi-nodes-after-invoke.ll
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-05-21 04:36:41 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-05-21 04:36:41 +0000
commit6f290d8f9e9d7faac295cb51fc96884a18f4ded4 (patch)
tree46e7d426abc0c9f06ac472ac6f7f9e661b5d78cb /test/regression/2008-02-11-phi-nodes-after-invoke.ll
parenta55960edd4dcd7535526de8d2277642522aa0209 (diff)
downloadklee-6f290d8f9e9d7faac295cb51fc96884a18f4ded4.tar.gz
Initial KLEE checkin.
 - Lots more tweaks, documentation, and web page content is needed,
   but this should compile & work on OS X & Linux.


git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72205 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/regression/2008-02-11-phi-nodes-after-invoke.ll')
-rw-r--r--test/regression/2008-02-11-phi-nodes-after-invoke.ll47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/regression/2008-02-11-phi-nodes-after-invoke.ll b/test/regression/2008-02-11-phi-nodes-after-invoke.ll
new file mode 100644
index 00000000..f6077f25
--- /dev/null
+++ b/test/regression/2008-02-11-phi-nodes-after-invoke.ll
@@ -0,0 +1,47 @@
+; RUN: llvm-as -f %s -o - | %klee --no-output --exit-on-error
+
+declare void @klee_abort()
+
+define i32 @foo(i32 %val, i32 %fail) {
+        %code = icmp ne i32 0, %fail
+        br i1 %code, label %failing, label %return
+failing:   
+        unwind        
+return:        
+	ret i32 %val
+}
+
+define void @test(i32 %should_fail) {
+entry:  
+	%res0 = invoke i32 (i32, i32)* @foo(i32 0, i32 %should_fail) 
+                        to label %check_phi unwind label %error
+        
+error:
+        %res1 = zext i8 1 to i32
+        br label %check_phi
+
+check_phi:
+        %val = phi i32 [%never_used, %never_used_label], [%res0, %entry], [%res1, %error]
+        %ok = icmp eq i32 %val, %should_fail
+        br i1 %ok, label %exit, label %on_error
+        call void @klee_abort()
+        unreachable
+
+on_error:
+        call void @klee_abort()
+        unreachable
+            
+exit:
+	ret void
+
+        ;; this is so we hopefully fail if incomingBBIndex isn't set properly
+never_used_label:       
+        %never_used = zext i8 undef to i32
+        br label %check_phi
+}
+
+define i32 @main() {
+        call void (i32)* @test(i32 0)
+        call void (i32)* @test(i32 1)
+	ret i32 0
+}