aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-11 03:35:04 +0000
committerChris Lattner <sabre@nondot.org>2004-02-11 03:35:04 +0000
commit54636af39d0cd384528e8c36c90434fbfb9dd114 (patch)
treee4ad84331f8f20c35c0ab56687a230d0758595dc
parent82a5ff4c549fd472cbcc5c880048ce4e4488a0f3 (diff)
New feature testcase for simplifycfg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11306 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Transforms/SimplifyCFG/PhiEliminate.ll35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/Transforms/SimplifyCFG/PhiEliminate.ll b/test/Transforms/SimplifyCFG/PhiEliminate.ll
new file mode 100644
index 0000000000..05cbe89bda
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/PhiEliminate.ll
@@ -0,0 +1,35 @@
+; Test a bunch of cases where the cfg simplification code should
+; be able to fold PHI nodes into computation in common cases. Folding the PHI
+; nodes away allows the branches to be eliminated, performing a simple form of
+; 'if conversion'.
+
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis > Output/%s.xform
+; RUN: not grep phi Output/%s.xform && grep ret Output/%s.xform
+
+declare void %use(bool)
+declare void %use(int)
+
+void %test(bool %c, int %V) {
+ br bool %c, label %T, label %F
+T:
+ br label %F
+F:
+ %B1 = phi bool [true, %0], [false, %T]
+ %B2 = phi bool [true, %T], [false, %0]
+ %I1 = phi int [1, %T], [0, %0]
+ %I2 = phi int [1, %0], [0, %T]
+ %I3 = phi int [17, %T], [0, %0]
+ %I4 = phi int [17, %T], [5, %0]
+ %I5 = phi int [%V, %T], [0, %0]
+ %I6 = phi int [%V, %0], [0, %T]
+ call void %use(bool %B1)
+ call void %use(bool %B2)
+ call void %use(int %I1)
+ call void %use(int %I2)
+ call void %use(int %I3)
+ call void %use(int %I4)
+ call void %use(int %I5)
+ call void %use(int %I6)
+ ret void
+}
+