new testcase
[oota-llvm.git] / test / Transforms / SimplifyCFG / branch-phi-thread.ll
1 ; RUN: llvm-as < %s | opt -simplifycfg -adce | llvm-dis | not grep 'call void %f1' &&
2 ; RUN: llvm-as < %s | opt -simplifycfg -adce -disable-output
3 declare void %f1()
4 declare void %f2()
5 declare void %f3()
6 declare void %f4()
7
8 implementation
9
10 int %test1(int %X, bool %D) {
11 E:
12         %C = seteq int %X, 0
13         br bool %C, label %T, label %F
14 T:
15         br bool %C, label %B, label %A
16 A:
17         call void %f1()
18         br bool %D, label %T, label %F
19 B:
20         call void %f2()
21         ret int 345
22 F:
23         call void %f3()
24         ret int 123
25 }
26
27 int %test2(int %X, bool %D) {
28 E:
29         %C = seteq int %X, 0
30         br bool %C, label %T, label %F
31 T:
32         %P = phi bool [true, %E], [%C, %A]
33         br bool %P, label %B, label %A
34 A:
35         call void %f1()
36         br bool %D, label %T, label %F
37 B:
38         call void %f2()
39         ret int 345
40 F:
41         call void %f3()
42         ret int 123
43 }
44