@@ -105,10 +105,12 @@ struct LifetimeDependence : CustomStringConvertible {
105
105
case let . initialized( initializer) :
106
106
let initialAddress = initializer. initialAddress
107
107
precondition ( initialAddress. type. isAddress, " expected an address " )
108
- precondition ( initialAddress is AllocStackInst || initialAddress is FunctionArgument ,
108
+ precondition ( initialAddress is AllocStackInst || initialAddress is FunctionArgument
109
+ || initialAddress is StoreBorrowInst ,
109
110
" expected storage for a a local 'let' " )
110
111
if case let . store( store, _) = initializer {
111
- precondition ( store is StoringInstruction || store is SourceDestAddrInstruction || store is FullApplySite ,
112
+ precondition ( store is StoringInstruction || store is SourceDestAddrInstruction || store is FullApplySite
113
+ || store is StoreBorrowInst ,
112
114
" expected a store " )
113
115
}
114
116
}
@@ -217,8 +219,8 @@ extension LifetimeDependence.Scope {
217
219
/// Construct a lifetime dependence scope from the base value that other values depend on. This derives the kind of
218
220
/// dependence scope and its parentValue from `base`.
219
221
///
220
- /// The returned Scope must be the only scope for the given 'base' value. This is generally non-recursive, except
221
- /// that finds the single borrow introducer. Use -def walking is handled by a utility such as
222
+ /// The returned Scope must be the only scope for the given 'base' value. This is generally non-recursive, except
223
+ /// that it tries to find the single borrow introducer. General use -def walking is handled by a utility such as
222
224
/// VariableIntroducerUseDefWalker, which can handle multiple introducers.
223
225
///
224
226
/// `base` represents the OSSA lifetime that the dependent value must be used within. If `base` is owned, then it
@@ -291,7 +293,8 @@ extension LifetimeDependence.Scope {
291
293
case let . yield( result) :
292
294
self . init ( yield: result)
293
295
case . storeBorrow( let sb) :
294
- self = Self ( base: sb. source, context)
296
+ // Don't follow the stored value in case the dependence requires addressability.
297
+ self = . initialized( . store( initializingStore: sb, initialAddress: sb) )
295
298
}
296
299
}
297
300
0 commit comments