[llvm-dev] llvm optimizer turning musttail into tail

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 28 09:21:05 PST 2016


On Sun, Nov 27, 2016 at 7:40 AM, Carlo Kok via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Inst combine yes. However it shouldn't drop this bit cast in the first
> place, since the last parameter isn't available. (It only works because of
> this must tail)
>

Aside from instcombine, the inliner will also transform musttail to tail.
The supported use cases for musttail are essentially:
- Avoiding unbounded stack growth for programming languages that require
tail recursion
- Perfect forwarding of parameters which cannot be copied (think C++
objects constructed in argument slots, aka inalloca)
- Perfect forwarding for thunks which are called with varying signatures
(these effectively forward the ellipsis of the caller)

The last case sounds the most like yours, in which case David's suggestion
is the right one.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161128/7fe89749/attachment.html>


More information about the llvm-dev mailing list