-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Closed as not planned
Labels
coroutinesC++20 coroutinesC++20 coroutinesduplicateResolved as duplicateResolved as duplicatemissed-optimization
Description
I was writing recursive generator and wanted to make a static 'empty generator'.
Because i cannot create promise by myself i create a lambda and static 'generator' which is always empty.
Unfortunately clang is not able to optimize generator allocation in such a trivial case, while 'static' means that compiler must be 100% sure its memory never dies
Example with task(co_await adds 'new' call, because compiler thinks memory for frame required):
https://godbolt.org/z/G9Mqa4zbj
So i propose to not allocate frame (through new) for static coroutines
Metadata
Metadata
Assignees
Labels
coroutinesC++20 coroutinesC++20 coroutinesduplicateResolved as duplicateResolved as duplicatemissed-optimization