Skip to content

Commit 57e226d

Browse files
committed
[CanOSSALifetime] Bail early in lifetime extension
While collecting originalLiveBlocks, walking backward from consuming blocks, if a visited block is already in originalLiveBlocks, don't visit its predecessors. Continuing the backwards walk is wasteful. rdar://110854874
1 parent 04ecc35 commit 57e226d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/SILOptimizer/Utils/CanonicalizeOSSALifetime.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,8 @@ void CanonicalizeOSSALifetime::extendUnconsumedLiveness(
558558

559559
// Walk backwards from consuming blocks.
560560
while (auto *block = worklist.pop()) {
561-
originalLiveBlocks.insert(block);
561+
if (!originalLiveBlocks.insert(block))
562+
continue;
562563
for (auto *predecessor : block->getPredecessorBlocks()) {
563564
// If the block was discovered by liveness, we already added it to the
564565
// set.

0 commit comments

Comments
 (0)