1 ; Test a bunch of cases where the cfg simplification code should
2 ; be able to fold PHI nodes into computation in common cases. Folding the PHI
3 ; nodes away allows the branches to be eliminated, performing a simple form of
6 ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis > Output/%s.xform
7 ; RUN: not grep phi Output/%s.xform && grep ret Output/%s.xform
9 declare void %use(bool)
10 declare void %use(int)
12 void %test(bool %c, int %V) {
13 br bool %c, label %T, label %F
17 %B1 = phi bool [true, %0], [false, %T]
18 %B2 = phi bool [true, %T], [false, %0]
19 %I1 = phi int [1, %T], [0, %0]
20 %I2 = phi int [1, %0], [0, %T]
21 %I3 = phi int [17, %T], [0, %0]
22 %I4 = phi int [17, %T], [5, %0]
23 %I5 = phi int [%V, %T], [0, %0]
24 %I6 = phi int [%V, %0], [0, %T]
25 call void %use(bool %B1)
26 call void %use(bool %B2)
27 call void %use(int %I1)
28 call void %use(int %I2)
29 call void %use(int %I3)
30 call void %use(int %I4)
31 call void %use(int %I5)
32 call void %use(int %I6)