@@ -992,11 +992,11 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
992
992
// FIXME: Whether the initial use is an initialization ought to be entirely
993
993
// derivable from the CheckKind of the mark instruction.
994
994
995
+ SILValue operand = address->getOperand ();
995
996
{
996
997
// Then check if our markedValue is from an argument that is in,
997
998
// in_guaranteed, inout, or inout_aliasable, consider the marked address to
998
999
// be the initialization point.
999
- SILValue operand = address->getOperand ();
1000
1000
if (auto *c = dyn_cast<CopyableToMoveOnlyWrapperAddrInst>(operand))
1001
1001
operand = c->getOperand ();
1002
1002
if (auto *fArg = dyn_cast<SILFunctionArgument>(operand)) {
@@ -1031,7 +1031,7 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
1031
1031
}
1032
1032
1033
1033
// 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 )) {
1035
1035
switch (access->getAccessKind ()) {
1036
1036
case SILAccessKind::Deinit:
1037
1037
case SILAccessKind::Read:
@@ -1049,7 +1049,8 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
1049
1049
// See if our address is from a closure guaranteed box that we did not promote
1050
1050
// to an address. In such a case, just treat our
1051
1051
// 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))) {
1053
1054
if (auto *fArg = dyn_cast<SILFunctionArgument>(projectBox->getOperand ())) {
1054
1055
if (fArg ->isClosureCapture ()) {
1055
1056
assert (fArg ->getArgumentConvention () ==
@@ -1074,8 +1075,8 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
1074
1075
1075
1076
// Check if our address is from a ref_element_addr. In such a case, we treat
1076
1077
// 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 ))) {
1079
1080
LLVM_DEBUG (llvm::dbgs ()
1080
1081
<< " Found ref_element_addr use... "
1081
1082
" adding mark_unresolved_non_copyable_value as init!\n " );
@@ -1085,40 +1086,39 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
1085
1086
// Check if our address is from a global_addr. In such a case, we treat the
1086
1087
// mark_unresolved_non_copyable_value as the initialization.
1087
1088
if (auto *globalAddr =
1088
- dyn_cast<GlobalAddrInst>(stripAccessMarkers (address-> getOperand () ))) {
1089
+ dyn_cast<GlobalAddrInst>(stripAccessMarkers (operand ))) {
1089
1090
LLVM_DEBUG (llvm::dbgs ()
1090
1091
<< " Found global_addr use... "
1091
1092
" adding mark_unresolved_non_copyable_value as init!\n " );
1092
1093
return true ;
1093
1094
}
1094
1095
1095
- if (auto *ptai = dyn_cast<PointerToAddressInst>(
1096
- stripAccessMarkers (address-> getOperand () ))) {
1096
+ if (auto *ptai =
1097
+ dyn_cast<PointerToAddressInst>( stripAccessMarkers (operand ))) {
1097
1098
assert (ptai->isStrict ());
1098
1099
LLVM_DEBUG (llvm::dbgs ()
1099
1100
<< " Found pointer to address use... "
1100
1101
" adding mark_unresolved_non_copyable_value as init!\n " );
1101
1102
return true ;
1102
1103
}
1103
-
1104
+
1104
1105
if (auto *bai = dyn_cast_or_null<BeginApplyInst>(
1105
- stripAccessMarkers (address-> getOperand () )->getDefiningInstruction ())) {
1106
+ stripAccessMarkers (operand )->getDefiningInstruction ())) {
1106
1107
LLVM_DEBUG (llvm::dbgs ()
1107
1108
<< " Adding accessor coroutine begin_apply as init!\n " );
1108
1109
return true ;
1109
1110
}
1110
-
1111
+
1111
1112
if (auto *eai = dyn_cast<UncheckedTakeEnumDataAddrInst>(
1112
- stripAccessMarkers (address-> getOperand () ))) {
1113
+ stripAccessMarkers (operand ))) {
1113
1114
LLVM_DEBUG (llvm::dbgs ()
1114
1115
<< " Adding enum projection as init!\n " );
1115
1116
return true ;
1116
1117
}
1117
1118
1118
1119
// Assume a strict check of a temporary or formal access is initialized
1119
1120
// before the check.
1120
- if (auto *asi = dyn_cast<AllocStackInst>(
1121
- stripAccessMarkers (address->getOperand ()));
1121
+ if (auto *asi = dyn_cast<AllocStackInst>(stripAccessMarkers (operand));
1122
1122
asi && address->isStrict ()) {
1123
1123
LLVM_DEBUG (llvm::dbgs ()
1124
1124
<< " Adding strict-marked alloc_stack as init!\n " );
@@ -1133,14 +1133,14 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
1133
1133
}
1134
1134
1135
1135
// 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 )) {
1137
1137
LLVM_DEBUG (llvm::dbgs ()
1138
1138
<< " Adding copyable_to_move_only_wrapper as init!\n " );
1139
1139
return true ;
1140
1140
}
1141
1141
1142
1142
// 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 )) {
1144
1144
LLVM_DEBUG (llvm::dbgs ()
1145
1145
<< " Adding copyable_to_move_only_wrapper as init!\n " );
1146
1146
return true ;
0 commit comments