@@ -281,26 +281,33 @@ bool noncopyable::memInstMustConsume(Operand *memOper) {
281
281
default :
282
282
return false ;
283
283
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;
288
293
case SILInstructionKind::CopyAddrInst: {
289
294
auto *CAI = cast<CopyAddrInst>(memInst);
290
295
return (CAI->getSrc () == address && CAI->isTakeOfSrc ()) ||
291
296
(CAI->getDest () == address && !CAI->isInitializationOfDest ());
292
297
}
298
+ case SILInstructionKind::DestroyAddrInst:
299
+ return true ;
300
+ case SILInstructionKind::DropDeinitInst:
301
+ assert (memOper->get ()->getType ().isValueTypeWithDeinit ());
302
+ return true ;
293
303
case SILInstructionKind::ExplicitCopyAddrInst: {
294
304
auto *CAI = cast<ExplicitCopyAddrInst>(memInst);
295
305
return (CAI->getSrc () == address && CAI->isTakeOfSrc ()) ||
296
306
(CAI->getDest () == address && !CAI->isInitializationOfDest ());
297
307
}
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;
304
311
case SILInstructionKind::PartialApplyInst: {
305
312
// If we are on the stack or have an inout convention, we do not
306
313
// consume. Otherwise, we do.
@@ -311,13 +318,6 @@ bool noncopyable::memInstMustConsume(Operand *memOper) {
311
318
auto convention = applySite.getArgumentConvention (*memOper);
312
319
return !convention.isInoutConvention ();
313
320
}
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;
321
321
}
322
322
}
323
323
0 commit comments