[llvm-dev] [Coroutine] Should we normalize the ramp function for whose initial_suspend isn't always_suspend?

chuanqi.xcq via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 22 18:18:30 PST 2021


Hi all,

I find that the ramp function of coroutine whose initial_suspend is always_suspend (Let me call it "init-suspend-coroutine") 
would be very simple. Normally it would only contain one basic block. And all of the codes in the coroutine body would be
in the resume function of coroutine.
For the ramp function of coroutine whose initial_suspend isn't always_suspend (Let me call it "init-no-suspend-coroutine"),
it may be large and it may contain the codes in the coroutine body. It may cause the size of codes be multiple of the original
size. And the large ramp function is harder to inline and harder to be elided.

I want to make the ramp function for init-no-suspend-coroutine keep the same formal with the init-suspend-coroutine.
My plan is to insert a fake suspend in the front of initial_suspend in the CodeGen phase of clang and in the llvm part, we can
insert a tail call to the resume function so the control flow would remain with the original.

Does any one have any suggestion?

Thanks,
Chuanqi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210223/ad1d5f66/attachment.html>


More information about the llvm-dev mailing list