@@ -525,7 +525,8 @@ static ManagedValue createInputFunctionArgument(
525525 //
526526 // NOTE: If we have a trivial value, the copy will do nothing, so this is
527527 // just a convenient way to avoid writing conditional code.
528- return ManagedValue::forUnmanaged (arg).copy (SGF, loc);
528+ return ManagedValue::forCopyOwnedObjectRValue (
529+ SGF, loc, arg, ManagedValue::ScopeKind::Lexical);
529530
530531 case SILArgumentConvention::Direct_Owned:
531532 return SGF.emitManagedRValueWithCleanup (arg);
@@ -706,13 +707,14 @@ ManagedValue SILGenBuilder::createUncheckedBitCast(SILLocation loc,
706707
707708 // If we have a trivial inst, just return early.
708709 if (isa<UncheckedTrivialBitCastInst>(cast))
709- return ManagedValue::forUnmanaged (cast);
710+ return ManagedValue::forObjectRValueWithoutOwnership (cast);
710711
711712 // If we perform an unchecked bitwise case, then we are producing a new RC
712713 // identity implying that we need a copy of the casted value to be returned so
713714 // that the inputs/outputs of the case have separate ownership.
714715 if (isa<UncheckedBitwiseCastInst>(cast)) {
715- return ManagedValue::forUnmanaged (cast).copy (SGF, loc);
716+ return ManagedValue::forCopyOwnedObjectRValue (
717+ SGF, loc, cast, ManagedValue::ScopeKind::Lexical);
716718 }
717719
718720 // Otherwise, we forward the cleanup of the input value and place the cleanup
@@ -762,7 +764,7 @@ ManagedValue SILGenBuilder::createOpenExistentialMetatype(SILLocation loc,
762764 SILType openedType) {
763765 SILValue result = SILGenBuilder::createOpenExistentialMetatype (
764766 loc, value.getValue (), openedType);
765- return ManagedValue::forTrivialRValue (result);
767+ return ManagedValue::forRValueWithoutOwnership (result);
766768}
767769
768770ManagedValue SILGenBuilder::createStore (SILLocation loc, ManagedValue value,
0 commit comments