blob: 05cbe89bda5494f328c7abbc7be937062481c1c2 [file] [log] [blame]
Chris Lattner54636af2004-02-11 03:35:04 +00001; 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
4; 'if conversion'.
5
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
8
9declare void %use(bool)
10declare void %use(int)
11
12void %test(bool %c, int %V) {
13 br bool %c, label %T, label %F
14T:
15 br label %F
16F:
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)
33 ret void
34}
35