aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-04-22 06:35:14 +0000
committerChris Lattner <sabre@nondot.org>2008-04-22 06:35:14 +0000
commitf29984f695a16d68f6983c7741e1ae77d1619c5d (patch)
treee93d39337fa781f99949aedc9675c508d35dc6a2 /test
parent75712b8b3f5fa9c2a27058b97a984aeb693b8f3e (diff)
downloadexternal_llvm-f29984f695a16d68f6983c7741e1ae77d1619c5d.zip
external_llvm-f29984f695a16d68f6983c7741e1ae77d1619c5d.tar.gz
external_llvm-f29984f695a16d68f6983c7741e1ae77d1619c5d.tar.bz2
add a basic testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50093 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/JumpThreading/basic.ll31
-rw-r--r--test/Transforms/JumpThreading/dg.exp3
2 files changed, 34 insertions, 0 deletions
diff --git a/test/Transforms/JumpThreading/basic.ll b/test/Transforms/JumpThreading/basic.ll
new file mode 100644
index 0000000..5d99a7c
--- /dev/null
+++ b/test/Transforms/JumpThreading/basic.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -jump-threading -simplifycfg -mem2reg | llvm-dis | grep {ret i32 %v1}
+; There should be no uncond branches left.
+; RUN: llvm-as < %s | opt -jump-threading -simplifycfg -mem2reg | llvm-dis | not grep {br label}
+
+declare i32 @f1()
+declare i32 @f2()
+declare void @f3()
+
+define i32 @test(i1 %cond) {
+ br i1 %cond, label %T1, label %F1
+
+T1:
+ %v1 = call i32 @f1()
+ br label %Merge
+
+F1:
+ %v2 = call i32 @f2()
+ br label %Merge
+
+Merge:
+ %A = phi i1 [true, %T1], [false, %F1]
+ %B = phi i32 [%v1, %T1], [%v2, %F1]
+ br i1 %A, label %T2, label %F2
+
+T2:
+ call void @f3()
+ ret i32 %B
+
+F2:
+ ret i32 %B
+}
diff --git a/test/Transforms/JumpThreading/dg.exp b/test/Transforms/JumpThreading/dg.exp
new file mode 100644
index 0000000..de42dad
--- /dev/null
+++ b/test/Transforms/JumpThreading/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.ll]]