Use the llvm-upgrade program to upgrade llvm assembly.
[oota-llvm.git] / test / Transforms / SimplifyCFG / switch_switch_fold.ll
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | grep switch | wc -l | grep 1
2
3 ; Test that a switch going to a switch on the same value can be merged.   All 
4 ; three switches in this example can be merged into one big one.
5
6 declare void %foo1()
7 declare void %foo2()
8 declare void %foo3()
9 declare void %foo4()
10
11 void %test1(uint %V) {
12         switch uint %V, label %F [
13                  uint 4, label %T
14                  uint 17, label %T
15                  uint 5, label %T
16                  uint 1234, label %F
17         ]
18
19 T:
20         switch uint %V, label %F [
21                  uint 4, label %A
22                  uint 17, label %B
23                  uint 42, label %C
24         ]
25 A:
26         call void %foo1()
27         ret void
28
29 B:
30         call void %foo2()
31         ret void
32 C:
33         call void %foo3()
34         ret void
35
36 F:
37         switch uint %V, label %F [
38                  uint 4, label %B
39                  uint 18, label %B
40                  uint 42, label %D
41         ]
42 D:
43         call void %foo4()
44         ret void
45 }
46