This is the 4b patch in the coroutine series. CoroEaly pass now can lower coro.resume and coro.destroy intrinsics called via InvokeInst.
Documentation and overview is here: http://llvm.org/docs/Coroutines.html.
Upstreaming sequence (rough plan):
- Add documentation. (https://reviews.llvm.org/D22603)
- Add coroutine intrinsics. (https://reviews.llvm.org/D22659)
- Add empty coroutine passes. (https://reviews.llvm.org/D22847)
- Add coroutine devirtualization + tests.
a) Lower coro.resume and coro.destroy (https://reviews.llvm.org/D22998)
b) Handle invoke resumers <= we are here
c) Do devirtualization
- Add CGSCC restart trigger + tests.
- Add coroutine heap elision + tests.
- Add the rest of the logic (split into more patches)
Why not throw &I into a CallSite? CallSite abstracts over call and invoke.
You would need to add getIntrinsicID to CallSite.