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-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis > %t.xform
7 ; RUN: not grep phi %t.xform
8 ; RUN: grep ret %t.xform
10 declare void %use(bool)
11 declare void %use(int)
14 void %test2(bool %c, bool %d, int %V, int %V2) {
15 br bool %d, label %X, label %F
17 br bool %c, label %T, label %F
21 %B1 = phi bool [true, %0], [false, %T], [false, %X]
22 %I7 = phi int [%V, %0], [%V2, %T], [%V2, %X]
23 call void %use(bool %B1)
24 call void %use(int %I7)
28 void %test(bool %c, int %V, int %V2) {
29 br bool %c, label %T, label %F
33 %B1 = phi bool [true, %0], [false, %T]
34 %I6 = phi int [%V, %0], [0, %T]
35 call void %use(bool %B1)
36 call void %use(int %I6)