Use the llvm-upgrade program to upgrade llvm assembly.
[oota-llvm.git] / test / Transforms / TailCallElim / ackermann.ll
1 ; This function contains two tail calls, which should be eliminated
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -tailcallelim -stats -disable-output 2>&1 | grep '2 tailcallelim'
3
4 int %Ack(int %M.1, int %N.1) {
5 entry:
6         %tmp.1 = seteq int %M.1, 0              ; <bool> [#uses=1]
7         br bool %tmp.1, label %then.0, label %endif.0
8
9 then.0:
10         %tmp.4 = add int %N.1, 1                ; <int> [#uses=1]
11         ret int %tmp.4
12
13 endif.0:
14         %tmp.6 = seteq int %N.1, 0              ; <bool> [#uses=1]
15         br bool %tmp.6, label %then.1, label %endif.1
16
17 then.1:
18         %tmp.10 = add int %M.1, -1              ; <int> [#uses=1]
19         %tmp.8 = call int %Ack( int %tmp.10, int 1 )            ; <int> [#uses=1]
20         ret int %tmp.8
21
22 endif.1:
23         %tmp.13 = add int %M.1, -1              ; <int> [#uses=1]
24         %tmp.17 = add int %N.1, -1              ; <int> [#uses=1]
25         %tmp.14 = call int %Ack( int %M.1, int %tmp.17 )                ; <int> [#uses=1]
26         %tmp.11 = call int %Ack( int %tmp.13, int %tmp.14 )             ; <int> [#uses=1]
27         ret int %tmp.11
28 }
29