de606fc231451c30ff1739ff6241cc2e2689e584
[oota-llvm.git] / test / Transforms / TailCallElim / tail_call_with_branch.ll
1 ; This testcase is due to tail-duplication not wanting to copy the return
2 ; instruction into the terminating blocks because there was other code
3 ; optimized out of the function after the taildup happened.
4
5 ; RUN: llvm-as < %s | opt -tailcallelim | llvm-dis | not grep call
6
7 int %t4(int %a) {
8 entry:
9         %tmp.1 = and int %a, 1
10         %tmp.2 = cast int %tmp.1 to bool
11         br bool %tmp.2, label %then.0, label %else.0
12
13 then.0:
14         %tmp.5 = add int %a, -1
15         %tmp.3 = call int %t4( int %tmp.5 )
16         br label %return
17
18 else.0:
19         %tmp.7 = setne int %a, 0
20         br bool %tmp.7, label %then.1, label %return
21
22 then.1:
23         %tmp.11 = add int %a, -2
24         %tmp.9 = call int %t4( int %tmp.11 )
25         br label %return
26
27 return:
28         %result.0 = phi int [ 0, %else.0 ], [ %tmp.3, %then.0 ], [ %tmp.9, %then.1 ]
29         ret int %result.0
30 }
31