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
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) {