diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-24 07:21:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-24 07:21:09 +0000 |
commit | 2189a760241550a4ca44bd4a9150372d77afb84f (patch) | |
tree | 87deedddbddf036f9a356e4593658a1c8ddf9fb4 /test/Transforms/SimplifyCFG | |
parent | ec8b8bb9abffdcc22373a7f28803c18ed8efa102 (diff) | |
download | external_llvm-2189a760241550a4ca44bd4a9150372d77afb84f.zip external_llvm-2189a760241550a4ca44bd4a9150372d77afb84f.tar.gz external_llvm-2189a760241550a4ca44bd4a9150372d77afb84f.tar.bz2 |
New testcase. Switch instructions that go to switch instructions should be
merged.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11796 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/SimplifyCFG')
-rw-r--r-- | test/Transforms/SimplifyCFG/switch_switch_fold.ll | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/Transforms/SimplifyCFG/switch_switch_fold.ll b/test/Transforms/SimplifyCFG/switch_switch_fold.ll new file mode 100644 index 0000000..cafd7d7 --- /dev/null +++ b/test/Transforms/SimplifyCFG/switch_switch_fold.ll @@ -0,0 +1,46 @@ +; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep switch | wc -l | grep 1 + +; Test that a switch going to a switch on the same value can be merged. All +; three switches in this example can be merged into one big one. + +declare void %foo1() +declare void %foo2() +declare void %foo3() +declare void %foo4() + +void %test1(uint %V) { + switch uint %V, label %F [ + uint 4, label %T + uint 17, label %T + uint 5, label %T + uint 1234, label %F + ] + +T: + switch uint %V, label %F [ + uint 4, label %A + uint 17, label %B + uint 42, label %C + ] +A: + call void %foo1() + ret void + +B: + call void %foo2() + ret void +C: + call void %foo3() + ret void + +F: + switch uint %V, label %F [ + uint 4, label %B + uint 18, label %B + uint 42, label %D + ] +D: + call void %foo4() + ret void +} + |