Skip to content

Commit 0f0147d

Browse files
committed
[Gardening] MoveOnly: Alphabetized switch cases.
1 parent 76348df commit 0f0147d

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

lib/SILOptimizer/Mandatory/MoveOnlyUtils.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -281,26 +281,33 @@ bool noncopyable::memInstMustConsume(Operand *memOper) {
281281
default:
282282
return false;
283283

284-
case SILInstructionKind::DropDeinitInst:
285-
assert(memOper->get()->getType().isValueTypeWithDeinit());
286-
return true;
287-
284+
case SILInstructionKind::ApplyInst:
285+
case SILInstructionKind::BeginApplyInst:
286+
case SILInstructionKind::TryApplyInst: {
287+
FullApplySite applySite(memInst);
288+
return applySite.getCaptureConvention(*memOper).isOwnedConvention();
289+
}
290+
case SILInstructionKind::BeginAccessInst:
291+
return cast<BeginAccessInst>(memInst)->getAccessKind() ==
292+
SILAccessKind::Deinit;
288293
case SILInstructionKind::CopyAddrInst: {
289294
auto *CAI = cast<CopyAddrInst>(memInst);
290295
return (CAI->getSrc() == address && CAI->isTakeOfSrc()) ||
291296
(CAI->getDest() == address && !CAI->isInitializationOfDest());
292297
}
298+
case SILInstructionKind::DestroyAddrInst:
299+
return true;
300+
case SILInstructionKind::DropDeinitInst:
301+
assert(memOper->get()->getType().isValueTypeWithDeinit());
302+
return true;
293303
case SILInstructionKind::ExplicitCopyAddrInst: {
294304
auto *CAI = cast<ExplicitCopyAddrInst>(memInst);
295305
return (CAI->getSrc() == address && CAI->isTakeOfSrc()) ||
296306
(CAI->getDest() == address && !CAI->isInitializationOfDest());
297307
}
298-
case SILInstructionKind::BeginApplyInst:
299-
case SILInstructionKind::TryApplyInst:
300-
case SILInstructionKind::ApplyInst: {
301-
FullApplySite applySite(memInst);
302-
return applySite.getCaptureConvention(*memOper).isOwnedConvention();
303-
}
308+
case SILInstructionKind::LoadInst:
309+
return cast<LoadInst>(memInst)->getOwnershipQualifier() ==
310+
LoadOwnershipQualifier::Take;
304311
case SILInstructionKind::PartialApplyInst: {
305312
// If we are on the stack or have an inout convention, we do not
306313
// consume. Otherwise, we do.
@@ -311,13 +318,6 @@ bool noncopyable::memInstMustConsume(Operand *memOper) {
311318
auto convention = applySite.getArgumentConvention(*memOper);
312319
return !convention.isInoutConvention();
313320
}
314-
case SILInstructionKind::DestroyAddrInst:
315-
return true;
316-
case SILInstructionKind::LoadInst:
317-
return cast<LoadInst>(memInst)->getOwnershipQualifier() ==
318-
LoadOwnershipQualifier::Take;
319-
case SILInstructionKind::BeginAccessInst:
320-
return cast<BeginAccessInst>(memInst)->getAccessKind() == SILAccessKind::Deinit;
321321
}
322322
}
323323

0 commit comments

Comments
 (0)