Skip to content

Commit 77a0192

Browse files
committed
add missing lowering of explicit_copy_addr
1 parent 174a4a3 commit 77a0192

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

include/swift/SIL/SILCloner.h

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,11 +1484,20 @@ template <typename ImplClass>
14841484
void SILCloner<ImplClass>::visitExplicitCopyAddrInst(
14851485
ExplicitCopyAddrInst *Inst) {
14861486
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
1487-
recordClonedInstruction(
1488-
Inst, getBuilder().createExplicitCopyAddr(
1489-
getOpLocation(Inst->getLoc()), getOpValue(Inst->getSrc()),
1490-
getOpValue(Inst->getDest()), Inst->isTakeOfSrc(),
1491-
Inst->isInitializationOfDest()));
1487+
if (!getBuilder().hasOwnership()) {
1488+
recordClonedInstruction(
1489+
Inst, getBuilder().createCopyAddr(
1490+
getOpLocation(Inst->getLoc()), getOpValue(Inst->getSrc()),
1491+
getOpValue(Inst->getDest()), Inst->isTakeOfSrc(),
1492+
Inst->isInitializationOfDest()));
1493+
} else {
1494+
// preserve the explicit_*
1495+
recordClonedInstruction(
1496+
Inst, getBuilder().createExplicitCopyAddr(
1497+
getOpLocation(Inst->getLoc()), getOpValue(Inst->getSrc()),
1498+
getOpValue(Inst->getDest()), Inst->isTakeOfSrc(),
1499+
Inst->isInitializationOfDest()));
1500+
}
14921501
}
14931502

14941503
template <typename ImplClass>

0 commit comments

Comments
 (0)