[PATCH] D75440: [Coroutines] Optimized coroutine elision based on reachability

JunMa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 01:55:05 PST 2020


junparser created this revision.
junparser added a reviewer: modocache.
junparser added a project: LLVM.
Herald added subscribers: llvm-commits, hiraditya, EricWF.

For now, CoroElide pass can not handle case like:

  coroA (cond){
     if (cond)
       co_await coroB
    else 
       co_await coroC
  co_return
  }

However, CoroElide should worked for this.

In this patch, If dominate relation is not satisfied,  we iterate all paths from coro.begin to normal terminators to check whether there is any pathes from coro.begin to Terminators which not pass through any of the coro.destroys. If not, record the coro.begin.
As for the paths reach to normal terminators through suspend point,  they have been skipped during DFS.

TestPlan: check-llvm, check-clang, cppcoro


https://reviews.llvm.org/D75440

Files:
  llvm/lib/Transforms/Coroutines/CoroElide.cpp
  llvm/test/Transforms/Coroutines/coro-heap-elide.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75440.247570.patch
Type: text/x-patch
Size: 9347 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200302/2bf09404/attachment.bin>


More information about the llvm-commits mailing list