Skip to content

Commit e9df268

Browse files
committed
Add new api makeGuaranteedValueAvailable
1 parent 0429373 commit e9df268

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

include/swift/SILOptimizer/Utils/OwnershipOptUtils.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ void extendLocalBorrow(BeginBorrowInst *beginBorrow,
7373
/// newly created phis do not yet have a borrow scope.
7474
bool createBorrowScopeForPhiOperands(SILPhiArgument *newPhi);
7575

76+
SILValue
77+
makeGuaranteedValueAvailable(SILValue value, SILInstruction *user,
78+
DeadEndBlocks &deBlocks,
79+
InstModCallbacks callbacks = InstModCallbacks());
80+
7681
//===----------------------------------------------------------------------===//
7782
// GuaranteedOwnershipExtension
7883
//===----------------------------------------------------------------------===//

lib/SILOptimizer/Utils/OwnershipOptUtils.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,15 @@ SILValue OwnershipLifetimeExtender::borrowOverSingleNonLifetimeEndingUser(
973973
newValue, borrowPt, ArrayRef<SILInstruction *>(nonLifetimeEndingUser));
974974
}
975975

976+
SILValue swift::makeGuaranteedValueAvailable(SILValue value,
977+
SILInstruction *user,
978+
DeadEndBlocks &deBlocks,
979+
InstModCallbacks callbacks) {
980+
OwnershipFixupContext ctx{callbacks, deBlocks};
981+
OwnershipLifetimeExtender extender{ctx};
982+
return extender.borrowOverSingleNonLifetimeEndingUser(value, user);
983+
}
984+
976985
//===----------------------------------------------------------------------===//
977986
// OwnershipRAUWUtility - RAUW + fix ownership
978987
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)