Speculatively execute a block when the the block is the then part of a triangle shape...
[oota-llvm.git] / test / Transforms / SimplifyCFG / SpeculativeExec.ll
1 ; RUN: llvm-as < %s | opt -simplifycfg  | llvm-dis | grep select
2 ; RUN: llvm-as < %s | opt -simplifycfg  | llvm-dis | grep br | count 2
3
4 define i32 @t2(i32 %a, i32 %b, i32 %c) nounwind  {
5 entry:
6         %tmp1 = icmp eq i32 %b, 0
7         br i1 %tmp1, label %bb1, label %bb3
8
9 bb1:            ; preds = %entry
10         %tmp2 = icmp sgt i32 %c, 1
11         br i1 %tmp2, label %bb2, label %bb3
12
13 bb2:            ; preds = bb1
14         %tmp3 = add i32 %a, 1
15         br label %bb3
16
17 bb3:            ; preds = %bb2, %entry
18         %tmp4 = phi i32 [ %b, %entry ], [ %a, %bb1 ], [ %tmp3, %bb2 ]
19         %tmp5 = sub i32 %tmp4, 1
20         ret i32 %tmp5
21 }