Skip to content

Commit dc6c7ee

Browse files
authored
[CoroSplit] Rename Suspend/End to AlwaysKill/NeverKill (NFC) (#199150)
Rename them so that we can generalize to more intrinsics, for example, `llvm.coro.is_in_ramp` in #198226
1 parent 0784399 commit dc6c7ee

2 files changed

Lines changed: 9 additions & 17 deletions

File tree

llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class BlockToIndexMapping {
6060
// Kills: a bit vector which contains a set of indices of blocks that can
6161
// reach block 'i' but there is a path crossing a suspend point
6262
// not repeating 'i' (path to 'i' without cycles containing 'i').
63-
// Suspend: a boolean indicating whether block 'i' contains a suspend point.
64-
// End: a boolean indicating whether block 'i' contains a coro.end intrinsic.
63+
// AlwaysKill: a boolean indicating whether block 'i' always propagate kills.
64+
// NeverKill: a boolean indicating whether block 'i' never propagate kills.
6565
// KillLoop: There is a path from 'i' to 'i' not otherwise repeating 'i' that
6666
// crosses a suspend point.
6767
//
@@ -71,8 +71,8 @@ class SuspendCrossingInfo {
7171
struct BlockData {
7272
BitVector Consumes;
7373
BitVector Kills;
74-
bool Suspend = false;
75-
bool End = false;
74+
bool AlwaysKill = false;
75+
bool NeverKill = false;
7676
bool KillLoop = false;
7777
bool Changed = false;
7878
};

llvm/lib/Transforms/Coroutines/SuspendCrossingInfo.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,13 @@ bool SuspendCrossingInfo::computeBlockData(
121121
B.Consumes |= P.Consumes;
122122
B.Kills |= P.Kills;
123123

124-
// If block P is a suspend block, it should propagate kills into block
125-
// B for every block P consumes.
126-
if (P.Suspend)
124+
if (P.AlwaysKill)
127125
B.Kills |= P.Consumes;
128126
}
129127

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

180-
getBlockData(CE->getParent()).End = true;
172+
getBlockData(CE->getParent()).NeverKill = true;
181173
}
182174

183175
// Mark all suspend blocks and indicate that they kill everything they
@@ -187,7 +179,7 @@ SuspendCrossingInfo::SuspendCrossingInfo(
187179
auto markSuspendBlock = [&](IntrinsicInst *BarrierInst) {
188180
BasicBlock *SuspendBlock = BarrierInst->getParent();
189181
auto &B = getBlockData(SuspendBlock);
190-
B.Suspend = true;
182+
B.AlwaysKill = true;
191183
B.Kills |= B.Consumes;
192184
};
193185
for (auto *CSI : CoroSuspends) {

0 commit comments

Comments
 (0)