Skip to content

Commit c3ef007

Browse files
committed
Fix store_borrow cloning when we are cloning into a function w/o ownership
Map store_borrow return_address with the destination, so that while cloning a store_borrow into a function w/o ownership, users of store_borrow return address can be mapped with the lowered store's destination.
1 parent 5244e6f commit c3ef007

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

include/swift/SIL/SILCloner.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,12 +1160,10 @@ template <typename ImplClass>
11601160
void SILCloner<ImplClass>::visitStoreBorrowInst(StoreBorrowInst *Inst) {
11611161
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
11621162
if (!getBuilder().hasOwnership()) {
1163-
// TODO: Eliminate store_borrow result so we can use
1164-
// recordClonedInstruction. It is not "technically" necessary, but it is
1165-
// better from an invariant perspective.
11661163
getBuilder().createStore(
11671164
getOpLocation(Inst->getLoc()), getOpValue(Inst->getSrc()),
11681165
getOpValue(Inst->getDest()), StoreOwnershipQualifier::Unqualified);
1166+
mapValue(Inst, getOpValue(Inst->getDest()));
11691167
return;
11701168
}
11711169

0 commit comments

Comments
 (0)