- Make coroutine representation more robust against optimization that may duplicate instruction by introducing coro.id intrinsics that returns a token that will get fed into coro.alloc and coro.begin. Due to coro.id returning a token, it won't get duplicated and can be used as reliable indicator of coroutine identify when a particular coroutine call gets inlined.
- Move last three arguments of coro.begin into coro.id as they will be shared if coro.begin will get duplicated.
- doc + test + code updated to support the new intrinsic.
We should probably say something about coro.id here.
Missing the token.
Did you intend to send this part out for review?
This could just be auto *False = ConstantInt::getFalse(C)
Hmm... Is it possible for a coro.subfn to use a coro.begin via something weird like a phi?
No. I'll take it out. It is for the next patch.
Cool! I'll switch to that.
Sure, but, in that case, it would mean that the handle to coroutine escaped, moved out, was zero out and thus is not eligible for devirtualization.