Tail calls

The ref manual states: The optional "tail" marker indicates whether
the callee function accesses any allocas or varargs in the caller. If
the "tail" marker is present, the function call is eligible for tail
call optimization. Note that calls may be marked "tail" even if they
do not occur before a ret instruction.

Does "eligible" in the above mean that some analysis is performed, and
if the call is found to meet certain criteria it is turned into a tail
call? Or is it guaranteed to perform a tail call if 'tail' is

The last statement of that paragraph implies that some analysis is
involved, but [1] states that there is no analysis performed.


[1] http://nondot.org/sabre/LLVMNotes/GuaranteedEfficientTailCalls.txt

Eligible means that, if followed by a return and if the caller and callee are both "fastcc"you should be guaranteed to get a tail call. In practice however, tail calls aren't implemented by any of the targets, so you won't.

I consider this a serious bug, and welcome anyone interested in helping to improve this.