@@ -475,11 +475,11 @@ void MoveOnlyObjectCheckerPImpl::check(
475475 if (markedInst->getCheckKind () ==
476476 MarkUnresolvedNonCopyableValueInst::CheckKind::NoConsumeOrAssign) {
477477 if (auto *cvi = dyn_cast<CopyValueInst>(markedInst->getOperand ())) {
478- SingleValueInstruction *i = cvi;
478+ auto replacement = cvi->getOperand ();
479+ auto orig = replacement;
479480 if (auto *copyToMoveOnly =
480- dyn_cast<CopyableToMoveOnlyWrapperValueInst>(
481- cvi->getOperand ())) {
482- i = copyToMoveOnly;
481+ dyn_cast<CopyableToMoveOnlyWrapperValueInst>(orig)) {
482+ orig = copyToMoveOnly->getOperand ();
483483 }
484484
485485 // TODO: Instead of pattern matching specific code generation patterns,
@@ -492,14 +492,14 @@ void MoveOnlyObjectCheckerPImpl::check(
492492 // bb(%arg : @guaranteed $Type):
493493 // %copy = copy_value %arg
494494 // %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 )) {
496496 if (arg->getOwnershipKind () == OwnershipKind::Guaranteed) {
497497 for (auto *use : markedInst->getConsumingUses ()) {
498498 destroys.push_back (cast<DestroyValueInst>(use->getUser ()));
499499 }
500500 while (!destroys.empty ())
501501 destroys.pop_back_val ()->eraseFromParent ();
502- markedInst->replaceAllUsesWith (arg );
502+ markedInst->replaceAllUsesWith (replacement );
503503 markedInst->eraseFromParent ();
504504 cvi->eraseFromParent ();
505505 continue ;
@@ -511,13 +511,13 @@ void MoveOnlyObjectCheckerPImpl::check(
511511 // %1 = load_borrow %0
512512 // %2 = copy_value %1
513513 // %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 )) {
515515 for (auto *use : markedInst->getConsumingUses ()) {
516516 destroys.push_back (cast<DestroyValueInst>(use->getUser ()));
517517 }
518518 while (!destroys.empty ())
519519 destroys.pop_back_val ()->eraseFromParent ();
520- markedInst->replaceAllUsesWith (lbi );
520+ markedInst->replaceAllUsesWith (replacement );
521521 markedInst->eraseFromParent ();
522522 cvi->eraseFromParent ();
523523 continue ;
@@ -527,15 +527,14 @@ void MoveOnlyObjectCheckerPImpl::check(
527527 // (%yield, ..., %handle) = begin_apply
528528 // %copy = copy_value %yield
529529 // %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) {
533532 for (auto *use : markedInst->getConsumingUses ()) {
534533 destroys.push_back (cast<DestroyValueInst>(use->getUser ()));
535534 }
536535 while (!destroys.empty ())
537536 destroys.pop_back_val ()->eraseFromParent ();
538- markedInst->replaceAllUsesWith (i-> getOperand ( 0 ) );
537+ markedInst->replaceAllUsesWith (replacement );
539538 markedInst->eraseFromParent ();
540539 cvi->eraseFromParent ();
541540 continue ;
0 commit comments