[PATCH] D82314: [Coroutines] Optimize the lifespan of temporary co_await object

Xun Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 26 16:38:27 PDT 2020


lxfind added a comment.

In D82314#2117543 <https://reviews.llvm.org/D82314#2117543>, @lewissbaker wrote:

> >   There are still room for improvements, in particular, GCC has a 4K frame for this function.
>
> I think GCC having a smaller coroutine frame is probably because it does not yet implement the allocation-elision optimisation which inlines the nested coroutine frame (which is 4K) into the parent coroutine frame.
>  I have not looked yet, but I suspect that you'll see within the get_big_object2() code it will perform another heap allocation for the get_big_object() frame.
>
> Until we have more general support for async RVO, I think 8K is probably as good as we're going to be able to get (4K for this coroutine's promise and 4K for child coroutine-frame and its promise).


Yes your observation is correct. It's due to the nesting of the child frame.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82314/new/

https://reviews.llvm.org/D82314





More information about the cfe-commits mailing list