@@ -805,10 +805,6 @@ struct OwnershipLifetimeExtender {
805805 // / the BorrowedValue that begins the scope.
806806 SILValue borrowOverSingleUse (SILValue newValue,
807807 Operand *singleGuaranteedUse);
808-
809- SILValue
810- borrowOverSingleNonLifetimeEndingUser (SILValue newValue,
811- SILInstruction *nonLifetimeEndingUser);
812808};
813809
814810} // end anonymous namespace
@@ -973,7 +969,14 @@ BeginBorrowInst *OwnershipLifetimeExtender::borrowCopyOverGuaranteedUsers(
973969 // Create destroys at the end of copy's lifetime. This only needs to consider
974970 // uses that end the borrow scope.
975971 {
976- ValueLifetimeAnalysis lifetimeAnalysis (copy, borrow->getEndBorrows ());
972+ SmallVector<SILInstruction *, 16 > users;
973+ for (auto *user : guaranteedUsers) {
974+ users.push_back (user);
975+ }
976+ for (auto *user : borrow->getEndBorrows ()) {
977+ users.push_back (user);
978+ }
979+ ValueLifetimeAnalysis lifetimeAnalysis (copy, users);
977980 ValueLifetimeBoundary copyBoundary;
978981 lifetimeAnalysis.computeLifetimeBoundary (copyBoundary);
979982
@@ -1092,27 +1095,6 @@ OwnershipLifetimeExtender::borrowOverSingleUse(SILValue newValue,
10921095 return newBeginBorrow;
10931096}
10941097
1095- SILValue OwnershipLifetimeExtender::borrowOverSingleNonLifetimeEndingUser (
1096- SILValue newValue, SILInstruction *nonLifetimeEndingUser) {
1097- // Avoid borrowing guaranteed function arguments.
1098- if (isa<SILFunctionArgument>(newValue) &&
1099- newValue->getOwnershipKind () == OwnershipKind::Guaranteed) {
1100- return newValue;
1101- }
1102- auto borrowPt = newValue->getNextInstruction ()->getIterator ();
1103- return borrowCopyOverGuaranteedUsers (
1104- newValue, borrowPt, ArrayRef<SILInstruction *>(nonLifetimeEndingUser));
1105- }
1106-
1107- SILValue swift::makeGuaranteedValueAvailable (SILValue value,
1108- SILInstruction *user,
1109- DeadEndBlocks &deBlocks,
1110- InstModCallbacks callbacks) {
1111- OwnershipFixupContext ctx{callbacks, deBlocks};
1112- OwnershipLifetimeExtender extender{ctx};
1113- return extender.borrowOverSingleNonLifetimeEndingUser (value, user);
1114- }
1115-
11161098// ===----------------------------------------------------------------------===//
11171099// OwnershipRAUWUtility - RAUW + fix ownership
11181100// ===----------------------------------------------------------------------===//
0 commit comments