Skip to content

Commit 3701f01

Browse files
committed
Mark ownership fixup instructions as live
1 parent 252a57a commit 3701f01

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/SILOptimizer/Transforms/DeadCodeElimination.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,11 +643,14 @@ void DCE::endLifetimeOfLiveValue(Operand *op, SILInstruction *insertPt) {
643643

644644
SILBuilderWithScope builder(insertPt);
645645
if (value->getOwnershipKind() == OwnershipKind::Owned) {
646-
builder.createDestroyValue(RegularLocation::getAutoGeneratedLocation(),
647-
value);
646+
auto *destroy = builder.createDestroyValue(
647+
RegularLocation::getAutoGeneratedLocation(), value);
648+
markInstructionLive(destroy);
648649
}
649650
if (value->getOwnershipKind() == OwnershipKind::Guaranteed) {
650-
builder.createEndBorrow(RegularLocation::getAutoGeneratedLocation(), value);
651+
auto *endBorrow = builder.createEndBorrow(
652+
RegularLocation::getAutoGeneratedLocation(), value);
653+
markInstructionLive(endBorrow);
651654
}
652655
}
653656

0 commit comments

Comments
 (0)