@@ -992,11 +992,11 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
992992 // FIXME: Whether the initial use is an initialization ought to be entirely
993993 // derivable from the CheckKind of the mark instruction.
994994
995+ SILValue operand = address->getOperand ();
995996 {
996997 // Then check if our markedValue is from an argument that is in,
997998 // in_guaranteed, inout, or inout_aliasable, consider the marked address to
998999 // be the initialization point.
999- SILValue operand = address->getOperand ();
10001000 if (auto *c = dyn_cast<CopyableToMoveOnlyWrapperAddrInst>(operand))
10011001 operand = c->getOperand ();
10021002 if (auto *fArg = dyn_cast<SILFunctionArgument>(operand)) {
@@ -1031,7 +1031,7 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
10311031 }
10321032
10331033 // A read or write access always begins on an initialized value.
1034- if (auto access = dyn_cast<BeginAccessInst>(address-> getOperand () )) {
1034+ if (auto access = dyn_cast<BeginAccessInst>(operand )) {
10351035 switch (access->getAccessKind ()) {
10361036 case SILAccessKind::Deinit:
10371037 case SILAccessKind::Read:
@@ -1049,7 +1049,8 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
10491049 // See if our address is from a closure guaranteed box that we did not promote
10501050 // to an address. In such a case, just treat our
10511051 // mark_unresolved_non_copyable_value as the init of our value.
1052- if (auto *projectBox = dyn_cast<ProjectBoxInst>(stripAccessMarkers (address->getOperand ()))) {
1052+ if (auto *projectBox =
1053+ dyn_cast<ProjectBoxInst>(stripAccessMarkers (operand))) {
10531054 if (auto *fArg = dyn_cast<SILFunctionArgument>(projectBox->getOperand ())) {
10541055 if (fArg ->isClosureCapture ()) {
10551056 assert (fArg ->getArgumentConvention () ==
@@ -1074,8 +1075,8 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
10741075
10751076 // Check if our address is from a ref_element_addr. In such a case, we treat
10761077 // the mark_unresolved_non_copyable_value as the initialization.
1077- if (auto *refEltAddr = dyn_cast<RefElementAddrInst>(
1078- stripAccessMarkers (address-> getOperand () ))) {
1078+ if (auto *refEltAddr =
1079+ dyn_cast<RefElementAddrInst>( stripAccessMarkers (operand ))) {
10791080 LLVM_DEBUG (llvm::dbgs ()
10801081 << " Found ref_element_addr use... "
10811082 " adding mark_unresolved_non_copyable_value as init!\n " );
@@ -1085,40 +1086,39 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
10851086 // Check if our address is from a global_addr. In such a case, we treat the
10861087 // mark_unresolved_non_copyable_value as the initialization.
10871088 if (auto *globalAddr =
1088- dyn_cast<GlobalAddrInst>(stripAccessMarkers (address-> getOperand () ))) {
1089+ dyn_cast<GlobalAddrInst>(stripAccessMarkers (operand ))) {
10891090 LLVM_DEBUG (llvm::dbgs ()
10901091 << " Found global_addr use... "
10911092 " adding mark_unresolved_non_copyable_value as init!\n " );
10921093 return true ;
10931094 }
10941095
1095- if (auto *ptai = dyn_cast<PointerToAddressInst>(
1096- stripAccessMarkers (address-> getOperand () ))) {
1096+ if (auto *ptai =
1097+ dyn_cast<PointerToAddressInst>( stripAccessMarkers (operand ))) {
10971098 assert (ptai->isStrict ());
10981099 LLVM_DEBUG (llvm::dbgs ()
10991100 << " Found pointer to address use... "
11001101 " adding mark_unresolved_non_copyable_value as init!\n " );
11011102 return true ;
11021103 }
1103-
1104+
11041105 if (auto *bai = dyn_cast_or_null<BeginApplyInst>(
1105- stripAccessMarkers (address-> getOperand () )->getDefiningInstruction ())) {
1106+ stripAccessMarkers (operand )->getDefiningInstruction ())) {
11061107 LLVM_DEBUG (llvm::dbgs ()
11071108 << " Adding accessor coroutine begin_apply as init!\n " );
11081109 return true ;
11091110 }
1110-
1111+
11111112 if (auto *eai = dyn_cast<UncheckedTakeEnumDataAddrInst>(
1112- stripAccessMarkers (address-> getOperand () ))) {
1113+ stripAccessMarkers (operand ))) {
11131114 LLVM_DEBUG (llvm::dbgs ()
11141115 << " Adding enum projection as init!\n " );
11151116 return true ;
11161117 }
11171118
11181119 // Assume a strict check of a temporary or formal access is initialized
11191120 // before the check.
1120- if (auto *asi = dyn_cast<AllocStackInst>(
1121- stripAccessMarkers (address->getOperand ()));
1121+ if (auto *asi = dyn_cast<AllocStackInst>(stripAccessMarkers (operand));
11221122 asi && address->isStrict ()) {
11231123 LLVM_DEBUG (llvm::dbgs ()
11241124 << " Adding strict-marked alloc_stack as init!\n " );
@@ -1133,14 +1133,14 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
11331133 }
11341134
11351135 // Assume a value whose deinit has been dropped has been initialized.
1136- if (auto *ddi = dyn_cast<DropDeinitInst>(address-> getOperand () )) {
1136+ if (auto *ddi = dyn_cast<DropDeinitInst>(operand )) {
11371137 LLVM_DEBUG (llvm::dbgs ()
11381138 << " Adding copyable_to_move_only_wrapper as init!\n " );
11391139 return true ;
11401140 }
11411141
11421142 // Assume a value wrapped in a MoveOnlyWrapper is initialized.
1143- if (auto *m2c = dyn_cast<CopyableToMoveOnlyWrapperAddrInst>(address-> getOperand () )) {
1143+ if (auto *m2c = dyn_cast<CopyableToMoveOnlyWrapperAddrInst>(operand )) {
11441144 LLVM_DEBUG (llvm::dbgs ()
11451145 << " Adding copyable_to_move_only_wrapper as init!\n " );
11461146 return true ;
0 commit comments