HomePhabricator

[Coroutine][Sema] Tighten the lifetime of symmetric transfer returned handle

Authored by lxfind on Sep 11 2020, 1:34 PM.

Description

[Coroutine][Sema] Tighten the lifetime of symmetric transfer returned handle

In generating the code for symmetric transfer, a temporary object is created to store the returned handle from await_suspend() call of the awaiter. Previously this temp won't be cleaned up until very later, which ends up causing this temp to be spilled to the heap. However, we know that this temp will no longer be needed after the coro_resume call. We can clean it up right after.

Differential Revision: https://reviews.llvm.org/D87470

Details