[ownership] Add support for cloning unmanaged_{retain,release}_value from ossa => non-ossa code.

Just an oversight on my part. I double checked that the only remaining
difference is in how we handle checked_cast_br and switch_enum. I have a
separate patch that fixes that.
This commit is contained in:
Michael Gottesman
2019-01-30 23:42:50 -08:00
parent 87b66e79a7
commit 70cb4655cc
2 changed files with 40 additions and 0 deletions

View File

@@ -1610,6 +1610,13 @@ template <typename ImplClass>
void SILCloner<ImplClass>::visitUnmanagedRetainValueInst(
UnmanagedRetainValueInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
if (!getBuilder().hasOwnership()) {
return recordClonedInstruction(
Inst, getBuilder().createRetainValue(getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand()),
Inst->getAtomicity()));
}
recordClonedInstruction(Inst, getBuilder().createUnmanagedRetainValue(
getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand()),
@@ -1653,6 +1660,12 @@ template <typename ImplClass>
void SILCloner<ImplClass>::visitUnmanagedReleaseValueInst(
UnmanagedReleaseValueInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
if (!getBuilder().hasOwnership()) {
return recordClonedInstruction(
Inst, getBuilder().createReleaseValue(getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand()),
Inst->getAtomicity()));
}
recordClonedInstruction(Inst, getBuilder().createUnmanagedReleaseValue(
getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand()),