aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-24 05:34:44 +0000
committerChris Lattner <sabre@nondot.org>2004-02-24 05:34:44 +0000
commitd1eaebef493ce086f7791be24a3eaacf355d1cdc (patch)
tree12feb2014a6346948a29787c3f82a39a71aed533 /test
parentc88c17b0f689443be31499d7bfb147651e5ac9a6 (diff)
downloadexternal_llvm-d1eaebef493ce086f7791be24a3eaacf355d1cdc.zip
external_llvm-d1eaebef493ce086f7791be24a3eaacf355d1cdc.tar.gz
external_llvm-d1eaebef493ce086f7791be24a3eaacf355d1cdc.tar.bz2
The simplifycfg pass should be able to turn stuff like:
if (X == 4 || X == 7) and if (X != 4 && X != 7) into switch instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11791 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/SimplifyCFG/switch_create.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Transforms/SimplifyCFG/switch_create.ll b/test/Transforms/SimplifyCFG/switch_create.ll
new file mode 100644
index 0000000..95d7d4a
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/switch_create.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+
+declare void %foo1()
+declare void %foo2()
+
+void %test1(uint %V) {
+ %C1 = seteq uint %V, 4
+ %C2 = seteq uint %V, 17
+ %CN = or bool %C1, %C2
+ br bool %CN, label %T, label %F
+T:
+ call void %foo1()
+ ret void
+F:
+ call void %foo2()
+ ret void
+}
+
+
+void %test2(int %V) {
+ %C1 = setne int %V, 4
+ %C2 = setne int %V, 17
+ %CN = and bool %C1, %C2
+ br bool %CN, label %T, label %F
+T:
+ call void %foo1()
+ ret void
+F:
+ call void %foo2()
+ ret void
+}
+
+