[clang] [llvm] [coroutine] Implement llvm.coro.await.suspend intrinsic (PR #79712)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 4 03:11:54 PST 2024
================
@@ -1513,6 +1580,11 @@ static void handleNoSuspendCoroutine(coro::Shape &Shape) {
// the coroutine and if that is the case we cannot eliminate the suspend point.
static bool hasCallsInBlockBetween(Instruction *From, Instruction *To) {
for (Instruction *I = From; I != To; I = I->getNextNode()) {
+ // This one could resume the coroutine,
+ // but additional analysis before the check should ensure,
+ // that it can't happen
+ if (isa<CoroAwaitSuspendInst>(I))
+ continue;
----------------
fpasserby wrote:
No, because `CoroAwaitSuspendInst` is not a proper `IntrinsicInst`, because it can be invoked. I'm not sure what else could be done about it (aside from deriving `IntrinisicInst` from `CallBase` instead of `CallInst`). Also it seems like special handling for it should be added to `InlineCost.cpp` and this intrinisic should return true in `mayLowerToFunctionCall`. Callback metadata should probabply be attached to the intrinsic, but I wasn't able to find a way to do it.
https://github.com/llvm/llvm-project/pull/79712
More information about the llvm-commits
mailing list