OSDN Git Service

[Coroutines] Part14: Handle coroutines with no suspend points.
authorGor Nishanov <GorNishanov@gmail.com>
Mon, 26 Sep 2016 15:49:28 +0000 (15:49 +0000)
committerGor Nishanov <GorNishanov@gmail.com>
Mon, 26 Sep 2016 15:49:28 +0000 (15:49 +0000)
commit8a7cd49d0b170b8d2689987452fbb74c0d015c98
treea04268296f347a9c17bf7f237636f2f7b8363a9c
parent51e92d172ed0fdd01fb2c5cd6bb2837097a4a858
[Coroutines] Part14: Handle coroutines with no suspend points.

Summary:
If coroutine has no suspend points, remove heap allocation and turn a coroutine into a normal function.

Also, if a pattern is detected that coroutine resumes or destroys itself prior to coro.suspend call, turn the suspend point into a simple jump to resume or cleanup label. This pattern occurs when coroutines are used to propagate errors in functions that return expected<T>.

Reviewers: majnemer

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282414 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Coroutines/CoroInstr.h
lib/Transforms/Coroutines/CoroSplit.cpp
test/Transforms/Coroutines/no-suspend.ll [new file with mode: 0644]