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