File tree Expand file tree Collapse file tree 6 files changed +22
-17
lines changed
SwiftCompilerSources/Sources/SIL Expand file tree Collapse file tree 6 files changed +22
-17
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,7 @@ extension FunctionConvention {
313
313
}
314
314
if scope {
315
315
let addressable = bridged. checkAddressable ( bridgedIndex ( parameterIndex: index) )
316
+ || bridged. checkConditionallyAddressable ( bridgedIndex ( parameterIndex: index) )
316
317
return . scope( addressable: addressable)
317
318
}
318
319
return nil
Original file line number Diff line number Diff line change @@ -250,11 +250,10 @@ class LifetimeDependenceInfo {
250
250
assert (!inheritLifetimeParamIndices ||
251
251
!inheritLifetimeParamIndices->isEmpty ());
252
252
assert (!scopeLifetimeParamIndices || !scopeLifetimeParamIndices->isEmpty ());
253
- assert ((!conditionallyAddressableParamIndices
254
- || (addressableParamIndices
255
- && conditionallyAddressableParamIndices
256
- ->isSubsetOf (addressableParamIndices)))
257
- && " conditionally-addressable params not a subset of addressable params?" );
253
+ assert ((!addressableParamIndices
254
+ || !conditionallyAddressableParamIndices
255
+ || conditionallyAddressableParamIndices->isDisjointWith (
256
+ addressableParamIndices)));
258
257
}
259
258
260
259
operator bool () const { return !empty (); }
Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ struct BridgedLifetimeDependenceInfo {
159
159
swift::IndexSubset *_Nullable inheritLifetimeParamIndices;
160
160
swift::IndexSubset *_Nullable scopeLifetimeParamIndices;
161
161
swift::IndexSubset *_Nullable addressableParamIndices;
162
+ swift::IndexSubset *_Nullable conditionallyAddressableParamIndices;
162
163
SwiftUInt targetIndex;
163
164
bool immortal;
164
165
@@ -168,6 +169,7 @@ struct BridgedLifetimeDependenceInfo {
168
169
BRIDGED_INLINE bool checkInherit (SwiftInt index) const ;
169
170
BRIDGED_INLINE bool checkScope (SwiftInt index) const ;
170
171
BRIDGED_INLINE bool checkAddressable (SwiftInt index) const ;
172
+ BRIDGED_INLINE bool checkConditionallyAddressable (SwiftInt index) const ;
171
173
BRIDGED_INLINE SwiftInt getTargetIndex () const ;
172
174
173
175
BRIDGED_INLINE BridgedOwnedString getDebugDescription () const ;
Original file line number Diff line number Diff line change @@ -147,6 +147,8 @@ BridgedLifetimeDependenceInfo::BridgedLifetimeDependenceInfo(swift::LifetimeDepe
147
147
: inheritLifetimeParamIndices(info.getInheritIndices()),
148
148
scopeLifetimeParamIndices(info.getScopeIndices()),
149
149
addressableParamIndices(info.getAddressableIndices()),
150
+ conditionallyAddressableParamIndices(
151
+ info.getConditionallyAddressableIndices()),
150
152
targetIndex(info.getTargetIndex()), immortal(info.isImmortal()) {}
151
153
152
154
SwiftInt BridgedLifetimeDependenceInfoArray::count () const {
@@ -177,6 +179,12 @@ bool BridgedLifetimeDependenceInfo::checkAddressable(SwiftInt index) const {
177
179
return addressableParamIndices && addressableParamIndices->contains (index);
178
180
}
179
181
182
+ bool BridgedLifetimeDependenceInfo::
183
+ checkConditionallyAddressable (SwiftInt index) const {
184
+ return conditionallyAddressableParamIndices
185
+ && conditionallyAddressableParamIndices->contains (index);
186
+ }
187
+
180
188
SwiftInt BridgedLifetimeDependenceInfo::getTargetIndex () const {
181
189
return targetIndex;
182
190
}
Original file line number Diff line number Diff line change @@ -63,11 +63,9 @@ std::string LifetimeDependenceInfo::getString() const {
63
63
}
64
64
result += kind;
65
65
if (addressable && addressable->contains (i)) {
66
- if (condAddressable && condAddressable->contains (i)) {
67
- result += " address_for_deps " ;
68
- } else {
69
- result += " address " ;
70
- }
66
+ result += " address " ;
67
+ } else if (condAddressable && condAddressable->contains (i)) {
68
+ result += " address_for_deps " ;
71
69
}
72
70
result += std::to_string (i);
73
71
isFirstSetBit = false ;
@@ -1136,7 +1134,6 @@ static std::optional<LifetimeDependenceInfo> checkSILTypeModifiers(
1136
1134
break ;
1137
1135
case LifetimeDescriptor::IsConditionallyAddressable:
1138
1136
conditionallyAddressableLifetimeParamIndices.set (index);
1139
- addressableLifetimeParamIndices.set (index);
1140
1137
break ;
1141
1138
case LifetimeDescriptor::IsAddressable:
1142
1139
addressableLifetimeParamIndices.set (index);
Original file line number Diff line number Diff line change @@ -1823,14 +1823,12 @@ class DestructureInputs {
1823
1823
// is addressable-for-dependencies, then lower it with maximal abstraction
1824
1824
// as well.
1825
1825
auto &initialSubstTL = TC.getTypeLowering (origType, substType, expansion);
1826
- if (initialSubstTL.getRecursiveProperties ().isAddressableForDependencies ()) {
1826
+ if (initialSubstTL.getRecursiveProperties ()
1827
+ .isAddressableForDependencies ()) {
1827
1828
origType = AbstractionPattern::getOpaque ();
1828
1829
1829
- // Remember that this lowered parameter is conditionally addressable in
1830
- // the addressable parameters vector.
1831
- AddressableLoweredParameters.resize (ParameterMap.size () + 1 , false );
1832
- AddressableLoweredParameters[ParameterMap.size ()] = true ;
1833
-
1830
+ // Remember that this lowered parameter is conditionally
1831
+ // addressable. Specialization may clear this flag.
1834
1832
ConditionallyAddressableLoweredParameters
1835
1833
.resize (ParameterMap.size () + 1 , false );
1836
1834
ConditionallyAddressableLoweredParameters[ParameterMap.size ()] = true ;
You can’t perform that action at this time.
0 commit comments