[LLVMdev] Removing -tailcallopt?
jon at ffconsultancy.com
Fri Feb 5 19:19:42 PST 2010
On Friday 05 February 2010 23:35:15 Evan Cheng wrote:
> Does anyone actually using it?
Yes, many LLVM-based projects rely upon TCO to work correctly.
> I'd prefer to just remove it to clean up the implementation if no one has
> any objections.
Are you saying that you want to remove LLVM's working TCO and replace it with
something that is faster but broken?
I think you may have misunderstood what TCO is and why users want it. TCO
allows an unbounded number of calls in tail position to use only a bounded
amount of stack space. Replacing branches within functions with tail calls
generalizes loops and makes them arbitrarily extensible. Consequently, many
language implementations (particularly functional languages) rely upon TCO to
implement loops. So breaking TCO literally means breaking loops for all of
You can imagine the reaction you would get if you went to the Clang guys and
advocated a new "for" loop because it was faster but segfaulted every 10,000
Moreover, working TCO is one of the features that sets LLVM apart from its
competitors. The JVM doesn't provide TCO. Mono's implementation of TCO is
broken. Microsoft's .NET is one of the only alternatives to provide working
TCO and even it has more restrictions than LLVM does.
The performance of tail calls on LLVM is a minor concern for me and I would
appreciate it being optimized but certainly not at the cost of correctness.
Dr Jon Harrop, Flying Frog Consultancy Ltd.
More information about the llvm-dev