[cfe-users] What option can make clang generate tail call IR?
gamma_chen
gamma_chen at yahoo.com.tw
Thu Dec 19 22:04:40 PST 2013
The following recursive example cannot generate "tail call". It generate "call" only. Anyone knows how to make "tail call"?
// clang -c 1.c -emit-llvm -o 1.bc
// llvm-dis 1.bc -o -
// File 1.c
int factorial(int x)
{
x--;
if (x <= 0)
return 1;
return x*factorial(x-1);
}
// output
define i32 @factorial(i32 %x) #0 {
...
%call = call i32 @factorial(i32 %sub)
..
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20131220/ea2054ac/attachment.html>
More information about the cfe-users
mailing list