This patch adds simple coroutine splitting logic to CoroSplit pass.
Documentation and overview is here: http://llvm.org/docs/Coroutines.html.
Upstreaming sequence (rough plan)
1.Add documentation. (https://reviews.llvm.org/D22603)
2.Add coroutine intrinsics. (https://reviews.llvm.org/D22659)
...
- Split coroutine into subfunctions <= we are here
- Coroutine Frame Building algorithm
- Handle coroutine with unwinds
10+. The rest of the logic
I'd just make simplifyFunctionCFG a non-internal function and call it instead of making a new FPM.