Skip to content

Commit 8f91b9e

Browse files
committed
[ownership] Get rid of old entrypoint for creatingEndBorrow that takes the original value.
The original design was to make it so that end_borrow tied at the use level its original/borrowed value. So we would have: ``` %borrowedVal = begin_borrow %original ... end_borrow %borrowedVal from %original ``` In the end we decided not to use that design and instead just use: ``` %borrowedVal = begin_borrow %original ... end_borrow %borrowedVal ``` In order to enable that transition, I left the old API for end_borrow that took both original and borrowedVal and reimplemented it on top of the new API that just took the borrowedVal (i.e. the original was just a dead arg). Now given where we are in the development, it makes sense to get rid of that transition API and move to just use the new API.
1 parent a4dbe67 commit 8f91b9e

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

Diff for: include/swift/SIL/SILBuilder.h

-6
Original file line numberDiff line numberDiff line change
@@ -806,12 +806,6 @@ class SILBuilder {
806806
EndBorrowInst(getSILDebugLocation(loc), borrowedValue));
807807
}
808808

809-
EndBorrowInst *createEndBorrow(SILLocation Loc, SILValue BorrowedValue,
810-
SILValue OriginalValue) {
811-
return insert(new (getModule())
812-
EndBorrowInst(getSILDebugLocation(Loc), BorrowedValue));
813-
}
814-
815809
BeginAccessInst *createBeginAccess(SILLocation loc, SILValue address,
816810
SILAccessKind accessKind,
817811
SILAccessEnforcement enforcement,

Diff for: include/swift/SIL/SILCloner.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -1177,9 +1177,8 @@ void SILCloner<ImplClass>::visitEndBorrowInst(EndBorrowInst *Inst) {
11771177
return;
11781178

11791179
recordClonedInstruction(
1180-
Inst,
1181-
getBuilder().createEndBorrow(getOpLocation(Inst->getLoc()),
1182-
getOpValue(Inst->getOperand()), SILValue()));
1180+
Inst, getBuilder().createEndBorrow(getOpLocation(Inst->getLoc()),
1181+
getOpValue(Inst->getOperand())));
11831182
}
11841183

11851184
template <typename ImplClass>

Diff for: lib/SILGen/FormalEvaluation.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ void FormalAccess::verify(SILGenFunction &SGF) const {
4848
//===----------------------------------------------------------------------===//
4949

5050
void SharedBorrowFormalAccess::finishImpl(SILGenFunction &SGF) {
51-
SGF.B.createEndBorrow(CleanupLocation::get(loc), borrowedValue,
52-
originalValue);
51+
SGF.B.createEndBorrow(CleanupLocation::get(loc), borrowedValue);
5352
}
5453

5554
//===----------------------------------------------------------------------===//

Diff for: lib/SILGen/SILGenLValue.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3711,7 +3711,7 @@ static SILValue emitLoadOfSemanticRValue(SILGenFunction &SGF,
37113711
if (!isTake) { \
37123712
SILValue value = SGF.B.createLoadBorrow(loc, src); \
37133713
SILValue strongValue = SGF.B.createStrongCopy##Name##Value(loc, value); \
3714-
SGF.B.createEndBorrow(loc, value, src); \
3714+
SGF.B.createEndBorrow(loc, value); \
37153715
return strongValue; \
37163716
} \
37173717
/* Otherwise perform a load take and destroy the stored value. */ \

0 commit comments

Comments
 (0)