File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
lib/SILOptimizer/Mandatory Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -3162,6 +3162,8 @@ class ApplyInst final
31623162 bool hasAddressResult () const {
31633163 return getSubstCalleeConv ().hasAddressResult ();
31643164 }
3165+
3166+ bool hasInoutResult () const { return getSubstCalleeConv ().hasInoutResult (); }
31653167};
31663168
31673169// / PartialApplyInst - Represents the creation of a closure object by partial
Original file line number Diff line number Diff line change @@ -472,6 +472,18 @@ static bool visitScopeEndsRequiringInit(
472472 return true ;
473473 }
474474
475+ // Check for mutate accessor.
476+ if (auto ai =
477+ dyn_cast_or_null<ApplyInst>(operand->getDefiningInstruction ())) {
478+ if (ai->hasInoutResult ()) {
479+ SmallVector<SILBasicBlock *, 8 > exitBlocks;
480+ markedAddr->getFunction ()->findExitingBlocks (exitBlocks);
481+ for (auto *block : exitBlocks) {
482+ visit (block->getTerminator (), ScopeRequiringFinalInit::InoutArgument);
483+ }
484+ return true ;
485+ }
486+ }
475487 return false ;
476488}
477489
You can’t perform that action at this time.
0 commit comments