blob: f65c66669e564e5c24c9e12691f039f5faffad3f [file] [log] [blame]
Chris Lattner50af7512003-09-20 05:02:54 +00001; This function contains two tail calls, which should be eliminated
Tanya Lattner5f4b3552008-03-10 07:21:50 +00002; RUN: llvm-as < %s | \
Reid Spencer86f337e2007-04-16 15:15:52 +00003; RUN: opt -tailcallelim -stats -disable-output |& grep {2 tailcallelim}
Chris Lattner50af7512003-09-20 05:02:54 +00004
Tanya Lattner5f4b3552008-03-10 07:21:50 +00005define i32 @Ack(i32 %M.1, i32 %N.1) {
Chris Lattner50af7512003-09-20 05:02:54 +00006entry:
Tanya Lattner5f4b3552008-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
Chris Lattner50af7512003-09-20 05:02:54 +000025}
26