blob: f65c66669e564e5c24c9e12691f039f5faffad3f [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; This function contains two tail calls, which should be eliminated
Tanya Lattner003eae52008-03-10 07:21:50 +00002; RUN: llvm-as < %s | \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003; RUN: opt -tailcallelim -stats -disable-output |& grep {2 tailcallelim}
4
Tanya Lattner003eae52008-03-10 07:21:50 +00005define i32 @Ack(i32 %M.1, i32 %N.1) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006entry:
Tanya Lattner003eae52008-03-10 07:21:50 +00007 %tmp.1 = icmp eq i32 %M.1, 0 ; <i1> [#uses=1]
8 br i1 %tmp.1, label %then.0, label %endif.0
9then.0: ; preds = %entry
10 %tmp.4 = add i32 %N.1, 1 ; <i32> [#uses=1]
11 ret i32 %tmp.4
12endif.0: ; preds = %entry
13 %tmp.6 = icmp eq i32 %N.1, 0 ; <i1> [#uses=1]
14 br i1 %tmp.6, label %then.1, label %endif.1
15then.1: ; preds = %endif.0
16 %tmp.10 = add i32 %M.1, -1 ; <i32> [#uses=1]
17 %tmp.8 = call i32 @Ack( i32 %tmp.10, i32 1 ) ; <i32> [#uses=1]
18 ret i32 %tmp.8
19endif.1: ; preds = %endif.0
20 %tmp.13 = add i32 %M.1, -1 ; <i32> [#uses=1]
21 %tmp.17 = add i32 %N.1, -1 ; <i32> [#uses=1]
22 %tmp.14 = call i32 @Ack( i32 %M.1, i32 %tmp.17 ) ; <i32> [#uses=1]
23 %tmp.11 = call i32 @Ack( i32 %tmp.13, i32 %tmp.14 ) ; <i32> [#uses=1]
24 ret i32 %tmp.11
Dan Gohmanf17a25c2007-07-18 16:29:46 +000025}
26