@@ -708,21 +708,6 @@ static Expr *lookThroughProjections(Expr *expr) {
708708 return lookThroughProjections (lookupExpr->getBase ());
709709}
710710
711- SILValue SILGenFunction::emitUncheckedGuaranteedConversion (SILValue value) {
712- assert (value->getType ().isObject ());
713- assert (F.getConventions ().hasGuaranteedResult ());
714- auto regularLoc = RegularLocation::getAutoGeneratedLocation ();
715- // Introduce a pair of unchecked_ownership_conversion instructions to
716- // avoid ownership errors from returning a load borrowed value.
717- // TODO: Introduce new SIL semantics to allow returning borrowed
718- // values from within a local borrow scope.
719- auto result = B.createUncheckedOwnershipConversion (regularLoc, value,
720- OwnershipKind::Unowned);
721- result = B.createUncheckedOwnershipConversion (regularLoc, result,
722- OwnershipKind::Guaranteed);
723- return result;
724- }
725-
726711bool SILGenFunction::emitBorrowOrMutateAccessorResult (
727712 SILLocation loc, Expr *ret, SmallVectorImpl<SILValue> &directResults) {
728713 auto *afd = cast<AbstractFunctionDecl>(FunctionDC->getAsDecl ());
@@ -734,9 +719,7 @@ bool SILGenFunction::emitBorrowOrMutateAccessorResult(
734719 assert (guaranteedAddress.getValue ()->getType ().isAddress ());
735720 assert (F.getConventions ().hasGuaranteedResult ());
736721 auto regularLoc = RegularLocation::getAutoGeneratedLocation ();
737- auto load =
738- B.createLoadBorrow (regularLoc, guaranteedAddress).getValue ();
739- return emitUncheckedGuaranteedConversion (load);
722+ return B.createLoadBorrow (regularLoc, guaranteedAddress).getValue ();
740723 };
741724
742725 // If the return expression is a literal, emit as a regular return
@@ -853,7 +836,7 @@ bool SILGenFunction::emitBorrowOrMutateAccessorResult(
853836 // unnecessary copy_value + mark_unresolved_non_copyable_value
854837 // instructions.
855838 if (selfType.isMoveOnly ()) {
856- result = lookThroughMoveOnlyCheckerPattern (result);
839+ result = lookThroughMoveOnlyCheckerPattern (result);
857840 }
858841 // If the SIL convention is @guaranteed and the generated result is an
859842 // address, emit a load_borrow.
0 commit comments