@@ -1484,11 +1484,20 @@ template <typename ImplClass>
1484
1484
void SILCloner<ImplClass>::visitExplicitCopyAddrInst(
1485
1485
ExplicitCopyAddrInst *Inst) {
1486
1486
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
+ }
1492
1501
}
1493
1502
1494
1503
template <typename ImplClass>
0 commit comments