[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)
commitbc0ebb383c54e8ada847c6a83e0dfc490e2f2aa1
tree69ab6cd735eb7ef12d5a7b7d0bc1a4afae13e3af
parent256fcf975f60f51fce9fe7f5992f9e409e60db29
[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

llvm-svn: 282414
llvm/lib/Transforms/Coroutines/CoroInstr.h
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/test/Transforms/Coroutines/no-suspend.ll [new file with mode: 0644]