Andrew Kelley via llvm-dev
2018-Mar-02 03:46 UTC
[llvm-dev] is it allowed to use musttail on llvm.coro.resume?
It makes sense that you would be able to do this: %save1 = llvm.coro.save() %unused = musttail call llvm.coro.resume(%some_handle) %x = llvm.coro.suspend() ... But the docs for musttail say:> The call must immediately precede a ret instruction, or a pointer bitcastfollowed by a ret instruction. Should this be amended to allow a musttail to be followed by llvm.coro.suspend() ? Regards, Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180301/d3dd45de/attachment.html>
Andrew Kelley via llvm-dev
2018-Mar-02 07:44 UTC
[llvm-dev] is it allowed to use musttail on llvm.coro.resume?
Just found this in CoroSplit.cpp: // Add musttail to any resume instructions that is immediately followed by a // suspend (i.e. ret). We do this even in -O0 to support guaranteed tail call // for symmetrical coroutine control transfer (C++ Coroutines TS extension). // This transformation is done only in the resume part of the coroutine that has // identical signature and calling convention as the coro.resume call. static void addMustTailToCoroResumes(Function &F) { On Thu, Mar 1, 2018 at 10:46 PM, Andrew Kelley <superjoe30 at gmail.com> wrote:> It makes sense that you would be able to do this: > > %save1 = llvm.coro.save() > %unused = musttail call llvm.coro.resume(%some_handle) > %x = llvm.coro.suspend() > ... > > But the docs for musttail say: > > The call must immediately precede a ret instruction, or a pointer > bitcast followed by a ret instruction. > > Should this be amended to allow a musttail to be followed by > llvm.coro.suspend() ? > > Regards, > Andrew >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180302/765aa00e/attachment.html>