summaryrefslogtreecommitdiff
path: root/test/ExecutionEngine/2005-12-02-TailCallBug.ll
blob: 447f49e9ad5e8edf0243c3e6a7e8d07ef0e5fc6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
; PR672
; RUN: llvm-upgrade < %s | llvm-as | lli

int %main(){ 
 %f   = cast int (int, int*, int)* %check_tail to int*
 %res = tail call fastcc int %check_tail( int 10, int* %f,int 10)
 ret int %res
}
fastcc int %check_tail(int %x, int* %f, int %g) {
	%tmp1 = setgt int %x, 0
	br bool %tmp1, label %if-then, label %if-else

if-then:
	%fun_ptr = cast int* %f to int(int, int*, int)*	
	%arg1    = add int %x, -1		
	%res = tail call fastcc int %fun_ptr( int %arg1, int * %f, int %g)
	ret int %res

if-else:
        ret int %x
}