@@ -475,11 +475,11 @@ void MoveOnlyObjectCheckerPImpl::check(
475
475
if (markedInst->getCheckKind () ==
476
476
MarkUnresolvedNonCopyableValueInst::CheckKind::NoConsumeOrAssign) {
477
477
if (auto *cvi = dyn_cast<CopyValueInst>(markedInst->getOperand ())) {
478
- SingleValueInstruction *i = cvi;
478
+ auto replacement = cvi->getOperand ();
479
+ auto orig = replacement;
479
480
if (auto *copyToMoveOnly =
480
- dyn_cast<CopyableToMoveOnlyWrapperValueInst>(
481
- cvi->getOperand ())) {
482
- i = copyToMoveOnly;
481
+ dyn_cast<CopyableToMoveOnlyWrapperValueInst>(orig)) {
482
+ orig = copyToMoveOnly->getOperand ();
483
483
}
484
484
485
485
// TODO: Instead of pattern matching specific code generation patterns,
@@ -492,14 +492,14 @@ void MoveOnlyObjectCheckerPImpl::check(
492
492
// bb(%arg : @guaranteed $Type):
493
493
// %copy = copy_value %arg
494
494
// %mark = mark_unresolved_non_copyable_value [no_consume_or_assign] %copy
495
- if (auto *arg = dyn_cast<SILArgument>(i-> getOperand ( 0 ) )) {
495
+ if (auto *arg = dyn_cast<SILArgument>(orig )) {
496
496
if (arg->getOwnershipKind () == OwnershipKind::Guaranteed) {
497
497
for (auto *use : markedInst->getConsumingUses ()) {
498
498
destroys.push_back (cast<DestroyValueInst>(use->getUser ()));
499
499
}
500
500
while (!destroys.empty ())
501
501
destroys.pop_back_val ()->eraseFromParent ();
502
- markedInst->replaceAllUsesWith (arg );
502
+ markedInst->replaceAllUsesWith (replacement );
503
503
markedInst->eraseFromParent ();
504
504
cvi->eraseFromParent ();
505
505
continue ;
@@ -511,13 +511,13 @@ void MoveOnlyObjectCheckerPImpl::check(
511
511
// %1 = load_borrow %0
512
512
// %2 = copy_value %1
513
513
// %3 = mark_unresolved_non_copyable_value [no_consume_or_assign] %2
514
- if (auto *lbi = dyn_cast<LoadBorrowInst>(i-> getOperand ( 0 ) )) {
514
+ if (auto *lbi = dyn_cast<LoadBorrowInst>(orig )) {
515
515
for (auto *use : markedInst->getConsumingUses ()) {
516
516
destroys.push_back (cast<DestroyValueInst>(use->getUser ()));
517
517
}
518
518
while (!destroys.empty ())
519
519
destroys.pop_back_val ()->eraseFromParent ();
520
- markedInst->replaceAllUsesWith (lbi );
520
+ markedInst->replaceAllUsesWith (replacement );
521
521
markedInst->eraseFromParent ();
522
522
cvi->eraseFromParent ();
523
523
continue ;
@@ -527,15 +527,14 @@ void MoveOnlyObjectCheckerPImpl::check(
527
527
// (%yield, ..., %handle) = begin_apply
528
528
// %copy = copy_value %yield
529
529
// %mark = mark_unresolved_noncopyable_value [no_consume_or_assign] %copy
530
- if (isa_and_nonnull<BeginApplyInst>(
531
- i->getOperand (0 )->getDefiningInstruction ())) {
532
- if (i->getOperand (0 )->getOwnershipKind () == OwnershipKind::Guaranteed) {
530
+ if (isa_and_nonnull<BeginApplyInst>(orig->getDefiningInstruction ())) {
531
+ if (orig->getOwnershipKind () == OwnershipKind::Guaranteed) {
533
532
for (auto *use : markedInst->getConsumingUses ()) {
534
533
destroys.push_back (cast<DestroyValueInst>(use->getUser ()));
535
534
}
536
535
while (!destroys.empty ())
537
536
destroys.pop_back_val ()->eraseFromParent ();
538
- markedInst->replaceAllUsesWith (i-> getOperand ( 0 ) );
537
+ markedInst->replaceAllUsesWith (replacement );
539
538
markedInst->eraseFromParent ();
540
539
cvi->eraseFromParent ();
541
540
continue ;
0 commit comments