blob: 83d98b84ea70e160c675f481e20ece7284f033a8 [file] [log] [blame]
Jan Wen Voung6dc30762013-03-12 16:27:52 +00001; REQUIRES: asserts
Chris Lattner50af7512003-09-20 05:02:54 +00002; This function contains two tail calls, which should be eliminated
Chandler Carruth5da53432012-07-02 18:37:59 +00003; RUN: opt < %s -tailcallelim -stats -disable-output 2>&1 | 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