Skip to content

Commit 2637c0b

Browse files
committed
[pruned-liveness] Change PrunedLiveBlocks::getLiveness(...) to return only one entry per live bit.
Previously, we would pan the array with isDead. The thinking is that this would make it easier to bitmask directly against. In practice, this usage was a minor use case and doing this lead to a bunch of logic mistakes in forthcoming code.
1 parent 72c7296 commit 2637c0b

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

include/swift/SIL/PrunedLiveness.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,6 @@ class PrunedLiveBlocks {
209209
unsigned actualStartBitNo = startBitNo * 2;
210210
unsigned actualEndBitNo = endBitNo * 2;
211211

212-
// NOTE: We pad both before/after with Dead to ensure that we are
213-
// returning an array that acts as a bit mask and thus can be directly
214-
// compared against other such bitmasks. This invariant is used when
215-
// computing boundaries.
216-
for (unsigned i = 0; i != startBitNo; ++i) {
217-
resultingFoundLiveness.push_back(Dead);
218-
}
219212
for (unsigned i = actualStartBitNo, e = actualEndBitNo; i != e; i += 2) {
220213
if (!bits[i]) {
221214
resultingFoundLiveness.push_back(Dead);
@@ -224,9 +217,6 @@ class PrunedLiveBlocks {
224217

225218
resultingFoundLiveness.push_back(bits[i + 1] ? LiveOut : LiveWithin);
226219
}
227-
for (unsigned i = endBitNo, e = size(); i != e; ++i) {
228-
resultingFoundLiveness.push_back(Dead);
229-
}
230220
}
231221

232222
void setLiveness(unsigned startBitNo, unsigned endBitNo, IsLive isLive) {
@@ -314,7 +304,7 @@ class PrunedLiveBlocks {
314304
SmallVectorImpl<IsLive> &foundLivenessInfo) const {
315305
auto liveBlockIter = liveBlocks.find(bb);
316306
if (liveBlockIter == liveBlocks.end()) {
317-
for (unsigned i : range(numBitsToTrack)) {
307+
for (unsigned i : range(endBitNo - startBitNo)) {
318308
(void)i;
319309
foundLivenessInfo.push_back(Dead);
320310
}

0 commit comments

Comments
 (0)