CoroElide pass works only when a post-split coroutine is inlined into another post-split coroutine.
In O0, there is no inlining after CoroSplit, and hence no CoroElide can happen.
It's useless to put CoroElide pass in the O0 pipeline and it will never be triggered (unless I miss anything).
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
On O0, it is possible to inline if the user marked the function with always_inline.
Since CoroElide is kind of optimization, it should be OK to skip in O0.
Out of curiosity, what's the reason that you want to remove it?
Coroutine functions cannot be inlined before splitting, even if it's marked "always_inline" (in fact, we should make it illegal to mark a coroutine "always_inline", because there is no guarantee that a coroutine can be fully inlined, GCC does that).
Yeah, but it may be inlined after splitting, which could trigger coro elide.
in fact, we should make it illegal to mark a coroutine "always_inline", because there is no guarantee that a coroutine can be fully inlined, GCC does that
To my understanding, it looks like that we shouldn't inline it since we couldn't inline all parts of the function. Is this what you want to say?
I think it may be a problem that we can't inline the full coroutine. But it's not the reason to forbid it.
Coro Elide is not defined in the standard (although it comes up in the proposal). So it should be a compiler optimization. In this way, it should be OK to remove it in O0.
Yeah, but it may be inlined after splitting, which could trigger coro elide.
In O0, there is no inliner pass (after CoroSplit), so inlining should never happen.
in fact, we should make it illegal to mark a coroutine "always_inline", because there is no guarantee that a coroutine can be fully inlined, GCC does that
To my understanding, it looks like that we shouldn't inline it since we couldn't inline all parts of the function. Is this what you want to say?
I think it may be a problem that we can't inline the full coroutine. But it's not the reason to forbid it.
That's a separate topic though. Let's agree on this diff first and then I can explain more about the always_inline issue.
Coro Elide is not defined in the standard (although it comes up in the proposal). So it should be a compiler optimization. In this way, it should be OK to remove it in O0.
That's a separate topic though. Let's agree on this diff first and then I can explain more about the always_inline issue.
Yeah, maybe we should discuss it on the llvm-dev thread.