Skip to content

Commit ab9dafd

Browse files
committed
[MoveChecker] All assigns add the same scope ends.
Use the same code path to add users at which an address must have been reinitialized for both kinds of mark_unresolved_non_copyable_value which permit assignment.
1 parent 111246f commit ab9dafd

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

lib/SILOptimizer/Mandatory/MoveOnlyAddressCheckerUtils.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,16 @@ static bool visitScopeEndsRequiringInit(
404404
SILValue operand = markedAddr->getOperand();
405405

406406
// TODO: This should really be a property of the marker instruction.
407-
if (markedAddr->getCheckKind() !=
408-
MarkUnresolvedNonCopyableValueInst::CheckKind::ConsumableAndAssignable) {
407+
switch (markedAddr->getCheckKind()) {
408+
case MarkUnresolvedNonCopyableValueInst::CheckKind::
409+
AssignableButNotConsumable:
410+
case MarkUnresolvedNonCopyableValueInst::CheckKind::ConsumableAndAssignable:
411+
break;
412+
case MarkUnresolvedNonCopyableValueInst::CheckKind::InitableButNotConsumable:
413+
case MarkUnresolvedNonCopyableValueInst::CheckKind::NoConsumeOrAssign:
409414
return false;
415+
case MarkUnresolvedNonCopyableValueInst::CheckKind::Invalid:
416+
llvm_unreachable("invalid check!?");
410417
}
411418

412419
// Check for inout types of arguments that are marked with consumable and
@@ -776,17 +783,6 @@ struct UseState {
776783
<< " Adding scope end as liveness user: " << *inst);
777784
scopeEndsRequiringInit[inst] = kind;
778785
});
779-
if (address->getCheckKind() == MarkUnresolvedNonCopyableValueInst::
780-
CheckKind::AssignableButNotConsumable) {
781-
if (auto *bai = dyn_cast<BeginAccessInst>(address->getOperand())) {
782-
for (auto *eai : bai->getEndAccesses()) {
783-
LLVM_DEBUG(llvm::dbgs() << " Adding end_access as implicit end of "
784-
"lifetime liveness user: "
785-
<< *eai);
786-
scopeEndsRequiringInit[eai] = ScopeRequiringFinalInit::ModifyMemoryAccess;
787-
}
788-
}
789-
}
790786
}
791787

792788
bool isConsume(SILInstruction *inst, TypeTreeLeafTypeRange span) const {

0 commit comments

Comments
 (0)