blob: dbc11b25c0b06d091a407dbceb92ab712dce9d73 [file] [log] [blame]
Chris Lattner3afb81e2006-04-13 18:15:24 +00001; PR672
Chris Lattneraad707b2005-12-03 17:20:57 +00002; RUN: llvm-as < %s | lli
Chris Lattner8e222002005-12-03 07:14:47 +00003
Chris Lattner3afb81e2006-04-13 18:15:24 +00004; This doesn't work on darwin/x86, xfail until PR736 is resolved.
5; XFAIL: i686-apple-darwin
Chris Lattner8e222002005-12-03 07:14:47 +00006
7int %main(){
8 %f = cast int (int, int*, int)* %check_tail to int*
9 %res = tail call fastcc int %check_tail( int 10, int* %f,int 10)
10 ret int %res
11}
12fastcc int %check_tail(int %x, int* %f, int %g) {
13 %tmp1 = setgt int %x, 0
14 br bool %tmp1, label %if-then, label %if-else
15
16if-then:
17 %fun_ptr = cast int* %f to int(int, int*, int)*
18 %arg1 = add int %x, -1
19 %res = tail call fastcc int %fun_ptr( int %arg1, int * %f, int %g)
20 ret int %res
21
22if-else:
23 ret int %x
24}