Skip to content

Commit 5f3d293

Browse files
committed
[NFC] MoveChecker: Inverted control flow.
Exited early.
1 parent b757b2e commit 5f3d293

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

lib/SILOptimizer/Mandatory/MoveOnlyAddressCheckerUtils.cpp

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -379,39 +379,41 @@ static bool isInOutDefThatNeedsEndOfFunctionLiveness(
379379
MarkUnresolvedNonCopyableValueInst *markedAddr) {
380380
SILValue operand = markedAddr->getOperand();
381381

382-
if (markedAddr->getCheckKind() ==
382+
// TODO: This should really be a property of the marker instruction.
383+
if (markedAddr->getCheckKind() !=
383384
MarkUnresolvedNonCopyableValueInst::CheckKind::ConsumableAndAssignable) {
384-
// TODO: This should really be a property of the marker instruction.
385-
386-
// Check for inout types of arguments that are marked with consumable and
387-
// assignable.
388-
if (auto *fArg = dyn_cast<SILFunctionArgument>(operand)) {
389-
switch (fArg->getArgumentConvention()) {
390-
case SILArgumentConvention::Indirect_In:
391-
case SILArgumentConvention::Indirect_Out:
392-
case SILArgumentConvention::Indirect_In_Guaranteed:
393-
case SILArgumentConvention::Direct_Guaranteed:
394-
case SILArgumentConvention::Direct_Owned:
395-
case SILArgumentConvention::Direct_Unowned:
396-
case SILArgumentConvention::Pack_Guaranteed:
397-
case SILArgumentConvention::Pack_Owned:
398-
case SILArgumentConvention::Pack_Out:
399-
return false;
400-
case SILArgumentConvention::Indirect_Inout:
401-
case SILArgumentConvention::Indirect_InoutAliasable:
402-
case SILArgumentConvention::Pack_Inout:
403-
LLVM_DEBUG(llvm::dbgs() << "Found inout arg: " << *fArg);
404-
return true;
405-
}
406-
}
407-
// Check for yields from a modify coroutine.
408-
if (auto bai = dyn_cast_or_null<BeginApplyInst>(operand->getDefiningInstruction())) {
385+
return false;
386+
}
387+
388+
// Check for inout types of arguments that are marked with consumable and
389+
// assignable.
390+
if (auto *fArg = dyn_cast<SILFunctionArgument>(operand)) {
391+
switch (fArg->getArgumentConvention()) {
392+
case SILArgumentConvention::Indirect_In:
393+
case SILArgumentConvention::Indirect_Out:
394+
case SILArgumentConvention::Indirect_In_Guaranteed:
395+
case SILArgumentConvention::Direct_Guaranteed:
396+
case SILArgumentConvention::Direct_Owned:
397+
case SILArgumentConvention::Direct_Unowned:
398+
case SILArgumentConvention::Pack_Guaranteed:
399+
case SILArgumentConvention::Pack_Owned:
400+
case SILArgumentConvention::Pack_Out:
401+
return false;
402+
case SILArgumentConvention::Indirect_Inout:
403+
case SILArgumentConvention::Indirect_InoutAliasable:
404+
case SILArgumentConvention::Pack_Inout:
405+
LLVM_DEBUG(llvm::dbgs() << "Found inout arg: " << *fArg);
409406
return true;
410407
}
411-
// Check for modify accesses.
412-
if (auto access = dyn_cast<BeginAccessInst>(operand)) {
413-
return access->getAccessKind() == SILAccessKind::Modify;
414-
}
408+
}
409+
// Check for yields from a modify coroutine.
410+
if (auto bai =
411+
dyn_cast_or_null<BeginApplyInst>(operand->getDefiningInstruction())) {
412+
return true;
413+
}
414+
// Check for modify accesses.
415+
if (auto access = dyn_cast<BeginAccessInst>(operand)) {
416+
return access->getAccessKind() == SILAccessKind::Modify;
415417
}
416418

417419
return false;

0 commit comments

Comments
 (0)