@@ -1698,6 +1698,16 @@ template<typename ImplClass>
1698
1698
void
1699
1699
SILCloner<ImplClass>::visitCopyAddrInst(CopyAddrInst *Inst) {
1700
1700
getBuilder ().setCurrentDebugScope (getOpScope (Inst->getDebugScope ()));
1701
+ // When cloning into a function using manual ownership, convert to explicit
1702
+ // copies, in order to preserve the local nature of the perf constraint.
1703
+ if (getBuilder ().hasManualOwnershipAttr () && getBuilder ().hasOwnership ()) {
1704
+ recordClonedInstruction (
1705
+ Inst, getBuilder ().createExplicitCopyAddr (
1706
+ getOpLocation (Inst->getLoc ()), getOpValue (Inst->getSrc ()),
1707
+ getOpValue (Inst->getDest ()), Inst->isTakeOfSrc (),
1708
+ Inst->isInitializationOfDest ()));
1709
+ return ;
1710
+ }
1701
1711
recordClonedInstruction (
1702
1712
Inst, getBuilder ().createCopyAddr (
1703
1713
getOpLocation (Inst->getLoc ()), getOpValue (Inst->getSrc ()),
@@ -2092,6 +2102,15 @@ void SILCloner<ImplClass>::visitCopyValueInst(CopyValueInst *Inst) {
2092
2102
return recordFoldedValue (Inst, newValue);
2093
2103
}
2094
2104
2105
+ // When cloning into a function using manual ownership, convert to explicit
2106
+ // copies, in order to preserve the local nature of the perf constraint.
2107
+ if (getBuilder ().hasManualOwnershipAttr () && getBuilder ().hasOwnership ()) {
2108
+ recordClonedInstruction (
2109
+ Inst, getBuilder ().createExplicitCopyValue (getOpLocation (Inst->getLoc ()),
2110
+ getOpValue (Inst->getOperand ())));
2111
+ return ;
2112
+ }
2113
+
2095
2114
recordClonedInstruction (
2096
2115
Inst, getBuilder ().createCopyValue (getOpLocation (Inst->getLoc ()),
2097
2116
getOpValue (Inst->getOperand ())));
0 commit comments