- 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.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
docs/Coroutines.rst | ||
---|---|---|
117–121 ↗ | (On Diff #67796) | We should probably say something about coro.id here. |
426 ↗ | (On Diff #67796) | Missing the token. |
lib/Transforms/Coroutines/CoroEarly.cpp | ||
55–58 ↗ | (On Diff #67796) | Did you intend to send this part out for review? |
lib/Transforms/Coroutines/CoroElide.cpp | ||
117 ↗ | (On Diff #67796) | This could just be auto *False = ConstantInt::getFalse(C) |
164–166 ↗ | (On Diff #67796) | Hmm... Is it possible for a coro.subfn to use a coro.begin via something weird like a phi? |
lib/Transforms/Coroutines/CoroEarly.cpp | ||
---|---|---|
55–58 ↗ | (On Diff #67796) | No. I'll take it out. It is for the next patch. |
lib/Transforms/Coroutines/CoroElide.cpp | ||
117 ↗ | (On Diff #67796) | Cool! I'll switch to that. |
164–166 ↗ | (On Diff #67796) | 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. |
Comment Actions
Feedback addressed. Preparing for landing.
- Fixes in Coroutines.rst
- use ConstantInt::getFalse
- remove commented out code
- add clarification comment about coro.subfn.addr