Fix a bug which prevented tail merging of return instructions in
[oota-llvm.git] / test / CodeGen / ARM / ifcvt2.ll
1 ; RUN: llc < %s -march=arm > %t
2 ; RUN: grep bxlt %t | count 1
3 ; RUN: grep bxgt %t | count 1
4 ; RUN: not grep bxge %t
5 ; RUN: not grep bxle %t
6
7 define i32 @t1(i32 %a, i32 %b, i32 %c, i32 %d) {
8         %tmp2 = icmp sgt i32 %c, 10
9         %tmp5 = icmp slt i32 %d, 4
10         %tmp8 = or i1 %tmp5, %tmp2
11         %tmp13 = add i32 %b, %a
12         br i1 %tmp8, label %cond_true, label %UnifiedReturnBlock
13
14 cond_true:
15         %tmp15 = add i32 %tmp13, %c
16         %tmp1821 = sub i32 %tmp15, %d
17         ret i32 %tmp1821
18
19 UnifiedReturnBlock:
20         ret i32 %tmp13
21 }
22
23 define i32 @t2(i32 %a, i32 %b, i32 %c, i32 %d) {
24         %tmp2 = icmp sgt i32 %c, 10
25         %tmp5 = icmp slt i32 %d, 4
26         %tmp8 = and i1 %tmp5, %tmp2
27         %tmp13 = add i32 %b, %a
28         br i1 %tmp8, label %cond_true, label %UnifiedReturnBlock
29
30 cond_true:
31         %tmp15 = add i32 %tmp13, %c
32         %tmp1821 = sub i32 %tmp15, %d
33         ret i32 %tmp1821
34
35 UnifiedReturnBlock:
36         ret i32 %tmp13
37 }