[llvm-dev] is it allowed to use musttail on llvm.coro.resume?

Andrew Kelley via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 1 23:44:09 PST 2018


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>


More information about the llvm-dev mailing list