Add testcase for new feature for simplifycfg pass
[oota-llvm.git] / test / Transforms / SimplifyCFG / PhiBlockMerge.ll
1 ; Test merging of blocks that only have PHI nodes in them
2 ;
3 ; RUN: if as < %s | opt -simplifycfg | dis | grep 'N:'
4 ; RUN: then exit 1
5 ; RUN: else exit 0
6 ; RUN: fi
7 ;
8
9 int %test(bool %a, bool %b) {
10         br bool %a, label %M, label %O
11
12 O:
13         br bool %b, label %N, label %Q
14 Q:
15         br label %N
16 N:
17         %Wp = phi int [0, %O], [1, %Q]
18         ; This block should be foldable into M
19         br label %M
20
21 M:
22         %W = phi int [%Wp, %N], [2, %0]
23         %R = add int %W, 1
24         ret int %R
25 }
26