Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class BlockToIndexMapping {
// Kills: a bit vector which contains a set of indices of blocks that can
// reach block 'i' but there is a path crossing a suspend point
// not repeating 'i' (path to 'i' without cycles containing 'i').
// Suspend: a boolean indicating whether block 'i' contains a suspend point.
// End: a boolean indicating whether block 'i' contains a coro.end intrinsic.
// AlwaysKill: a boolean indicating whether block 'i' always propagate kills.
// NeverKill: a boolean indicating whether block 'i' never propagate kills.
// KillLoop: There is a path from 'i' to 'i' not otherwise repeating 'i' that
// crosses a suspend point.
//
Expand All @@ -71,8 +71,8 @@ class SuspendCrossingInfo {
struct BlockData {
BitVector Consumes;
BitVector Kills;
bool Suspend = false;
bool End = false;
bool AlwaysKill = false;
bool NeverKill = false;
bool KillLoop = false;
bool Changed = false;
};
Expand Down
18 changes: 5 additions & 13 deletions llvm/lib/Transforms/Coroutines/SuspendCrossingInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,13 @@ bool SuspendCrossingInfo::computeBlockData(
B.Consumes |= P.Consumes;
B.Kills |= P.Kills;

// If block P is a suspend block, it should propagate kills into block
// B for every block P consumes.
if (P.Suspend)
if (P.AlwaysKill)
B.Kills |= P.Consumes;
}

if (B.Suspend) {
// If block B is a suspend block, it should kill all of the blocks it
// consumes.
if (B.AlwaysKill) {
B.Kills |= B.Consumes;
} else if (B.End) {
// If block B is an end block, it should not propagate kills as the
// blocks following coro.end() are reached during initial invocation
// of the coroutine while all the data are still available on the
// stack or in the registers.
} else if (B.NeverKill) {
B.Kills.reset();
} else {
// This is reached when B block it not Suspend nor coro.end and it
Expand Down Expand Up @@ -177,7 +169,7 @@ SuspendCrossingInfo::SuspendCrossingInfo(
assert(CE->getParent()->getFirstInsertionPt() == CE->getIterator() &&
CE->getParent()->size() <= 2 && "CoroEnd must be in its own BB");

getBlockData(CE->getParent()).End = true;
getBlockData(CE->getParent()).NeverKill = true;
}

// Mark all suspend blocks and indicate that they kill everything they
Expand All @@ -187,7 +179,7 @@ SuspendCrossingInfo::SuspendCrossingInfo(
auto markSuspendBlock = [&](IntrinsicInst *BarrierInst) {
BasicBlock *SuspendBlock = BarrierInst->getParent();
auto &B = getBlockData(SuspendBlock);
B.Suspend = true;
B.AlwaysKill = true;
B.Kills |= B.Consumes;
};
for (auto *CSI : CoroSuspends) {
Expand Down
Loading