@@ -805,10 +805,6 @@ struct OwnershipLifetimeExtender {
805
805
// / the BorrowedValue that begins the scope.
806
806
SILValue borrowOverSingleUse (SILValue newValue,
807
807
Operand *singleGuaranteedUse);
808
-
809
- SILValue
810
- borrowOverSingleNonLifetimeEndingUser (SILValue newValue,
811
- SILInstruction *nonLifetimeEndingUser);
812
808
};
813
809
814
810
} // end anonymous namespace
@@ -973,7 +969,14 @@ BeginBorrowInst *OwnershipLifetimeExtender::borrowCopyOverGuaranteedUsers(
973
969
// Create destroys at the end of copy's lifetime. This only needs to consider
974
970
// uses that end the borrow scope.
975
971
{
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);
977
980
ValueLifetimeBoundary copyBoundary;
978
981
lifetimeAnalysis.computeLifetimeBoundary (copyBoundary);
979
982
@@ -1092,27 +1095,6 @@ OwnershipLifetimeExtender::borrowOverSingleUse(SILValue newValue,
1092
1095
return newBeginBorrow;
1093
1096
}
1094
1097
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
-
1116
1098
// ===----------------------------------------------------------------------===//
1117
1099
// OwnershipRAUWUtility - RAUW + fix ownership
1118
1100
// ===----------------------------------------------------------------------===//
0 commit comments