Skip to content

Commit 4b3588c

Browse files
committed
[NFC] Mem2Reg: Delete this dead code.
Since the time that lifetimes in `alloc_stack [lexical]` began to be represented after promotion by `move_value [lexical]`s, the `endOwnedLexicalLifetimeBeforeInst` is just an assertion. In the future, lifetimes of values never destroyed that leak into dead end blocks should be completed by OSSACompleteLifetime. For now, just delete this code.
1 parent 69abf25 commit 4b3588c

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

lib/SILOptimizer/Transforms/SILMem2Reg.cpp

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,23 +2102,9 @@ void MemoryToRegisters::removeSingleBlockAllocation(AllocStackInst *asi) {
21022102
}
21032103
// There is still valid storage after visiting all instructions in this
21042104
// block which are the only instructions involving this alloc_stack.
2105-
// That can only happen if:
2106-
// - all paths from this block end in unreachable
2107-
2108-
if (lexicalLifetimeEnsured(asi) &&
2109-
runningVals->value.getStored()->getOwnershipKind().isCompatibleWith(
2110-
OwnershipKind::Owned)) {
2111-
// An owned value was stored to the alloc_stack [lexical] but never
2112-
// destroy_addr'd. Destroy it on the dominance boundary of the
2113-
// alloc_stack's parent block.
2114-
SmallVector<SILBasicBlock *, 4> boundary;
2115-
computeDominatedBoundaryBlocks(asi->getParent(), domInfo, boundary);
2116-
for (auto *block : boundary) {
2117-
auto *terminator = block->getTerminator();
2118-
runningVals->value.endLexicalLifetimeBeforeInstIfPossible(
2119-
asi, /*beforeInstruction=*/terminator, ctx);
2120-
}
2121-
}
2105+
// That can happen if:
2106+
// (1) this block is a dead-end. TODO: OSSACompleteLifetime: Complete such
2107+
// lifetimes.
21222108
}
21232109

21242110
void MemoryToRegisters::collectStoredValues(AllocStackInst *asi,

0 commit comments

Comments
 (0)