[PATCH] D100614: [Coroutine] Collect CoroBegin if all of terminators are dominated by one coro.destroy

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 19 18:48:40 PDT 2021


ChuanqiXu added a comment.

In D100614#2697468 <https://reviews.llvm.org/D100614#2697468>, @lxfind wrote:

> Does it require that all terminators to be dominated by the same coro.destroy?
> Reading the comments in the original code, I think the condition is that for each terminator it's dominated by a coro.destroy, but it doesn't require all terminators to be dominated by the same coro.destroy.
> The original code does seem to be buggy, but the fix may not be correct. Perhaps in the next statement, the check on hasEscapePath and ReferencedCoroBegins.count is problematic?

The codes I changed means if all terminators are dominated by one `coro.destroy` we can collect the corresponding `coro.begin` directly. Then if there is no `coro.destroy` to dominate all terminators, we could only search in `hasEscapePath`. The key idea here is `hasEscapePath` is relatively slow, so we want to avoid to call it as much as possible. The check on ReferencedCoroBegins.count and hasEscapePath just did this.


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

https://reviews.llvm.org/D100614



More information about the llvm-commits mailing list