Skip to content

Commit 508e676

Browse files
committed
[MoveObjectChecker] handle mark_depends
MoveOnlyBorrowsToDestructure: fix gatherBorrows to ignore mark_dependence base operand uses.
1 parent 72615fe commit 508e676

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/SILOptimizer/Mandatory/MoveOnlyBorrowToDestructureUtils.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,6 +1540,12 @@ static bool gatherBorrows(SILValue rootValue,
15401540
// escape. Is it legal to canonicalize ForwardingUnowned?
15411541
case OperandOwnership::ForwardingUnowned:
15421542
case OperandOwnership::PointerEscape:
1543+
if (auto *md = dyn_cast<MarkDependenceInst>(use->getUser())) {
1544+
// mark_depenence uses only keep its base value alive; they do not use
1545+
// the base value itself and are irrelevant for destructuring.
1546+
if (use == &md->getOperandRef(MarkDependenceInst::Base))
1547+
continue;
1548+
}
15431549
return false;
15441550

15451551
case OperandOwnership::InstantaneousUse:

0 commit comments

Comments
 (0)