Skip to content

Commit 7b63778

Browse files
committed
Comment describing isPresplitCorouSuspendExitEdge
1 parent 3ec71c6 commit 7b63778

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,22 @@ void InvertBranch(BranchInst *PBI, IRBuilderBase &Builder);
706706
// br/brcond/unreachable/ret
707707
bool hasOnlySimpleTerminator(const Function &F);
708708

709+
// Returns true if these basic blocks belong to a presplit coroutine and the
710+
// edge corresponds to the 'default' case in the switch statement in the
711+
// pattern:
712+
//
713+
// %0 = call i8 @llvm.coro.suspend(token none, i1 false)
714+
// switch i8 %0, label %suspend [i8 0, label %resume
715+
// i8 1, label %cleanup]
716+
//
717+
// i.e. the edge to the `%suspend` BB. This edge is special in that it will
718+
// be elided by coroutine lowering (coro-split), and the `%suspend` BB needs
719+
// to be kept as-is. It's not a real CFG edge - post-lowering, it will end
720+
// up being a `ret`, and it must be thus lowerable to support symmetric
721+
// transfer. For example:
722+
// - this edge is not a loop exit edge if encountered in a loop (and should
723+
// be ignored)
724+
// - must not be split for PGO instrumentation, for example.
709725
bool isPresplitCoroSuspendExitEdge(const BasicBlock &Src,
710726
const BasicBlock &Dest);
711727
} // end namespace llvm

0 commit comments

Comments
 (0)