<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Nov 27, 2016 at 7:40 AM, Carlo Kok via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>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)</div></blockquote><div><br></div><div>Aside from instcombine, the inliner will also transform musttail to tail. The supported use cases for musttail are essentially:</div><div>- Avoiding unbounded stack growth for programming languages that require tail recursion</div><div>- Perfect forwarding of parameters which cannot be copied (think C++ objects constructed in argument slots, aka inalloca)</div><div>- Perfect forwarding for thunks which are called with varying signatures (these effectively forward the ellipsis of the caller)</div><div><br></div><div>The last case sounds the most like yours, in which case David's suggestion is the right one.</div></div></div></div>