Skip to content

Commit 4a6f85c

Browse files
committed
[Gardening] Improved variable name.
1 parent 7d16503 commit 4a6f85c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/SILOptimizer/Utils/ShrinkBorrowScope.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,20 @@ void ShrinkBorrowScope::findBarriers() {
243243
// visited.
244244
//
245245
// TODO: Handle loops.
246-
SmallPtrSet<SILBasicBlock *, 8> blocksWithReachedTops;
247-
auto reachedTopOfAllSuccessors =
248-
[&blocksWithReachedTops](SILBasicBlock *block) -> bool {
246+
247+
// Blocks to the top of which the borrow scope has been shrunk.
248+
SmallPtrSet<SILBasicBlock *, 8> deadBlocks;
249+
auto hasOnlyDeadSuccessors =
250+
[&deadBlocks](SILBasicBlock *block) -> bool {
249251
return llvm::all_of(block->getSuccessorBlocks(), [=](auto *successor) {
250-
return blocksWithReachedTops.contains(successor);
252+
return deadBlocks.contains(successor);
251253
});
252254
};
253255

254256
while (!worklist.empty()) {
255257
auto *block = worklist.pop_back_val();
256258
auto *startingInstruction = startingInstructions.lookup(block);
257-
if (!startingInstruction && !reachedTopOfAllSuccessors(block)) {
259+
if (!startingInstruction && !hasOnlyDeadSuccessors(block)) {
258260
continue;
259261
}
260262
if (!startingInstruction &&
@@ -291,7 +293,7 @@ void ShrinkBorrowScope::findBarriers() {
291293
if (barrier) {
292294
barrierInstructions.push_back({block, barrier});
293295
} else {
294-
blocksWithReachedTops.insert(block);
296+
deadBlocks.insert(block);
295297
blocksToEndAtTop.insert(block);
296298
for (auto *predecessor : block->getPredecessorBlocks()) {
297299
worklist.push_back(predecessor);

0 commit comments

Comments
 (0)