@@ -272,6 +272,9 @@ private func insertParameterDependencies(apply: LifetimeDependentApply, target:
272
272
273
273
sources. initializeBases ( context)
274
274
275
+ assert ( target. value. type. isAddress,
276
+ " lifetime-dependent parameter must be 'inout' " )
277
+
275
278
Builder . insert ( after: apply. applySite, context) {
276
279
insertMarkDependencies ( value: target. value, initializer: nil , bases: sources. bases, builder: $0, context)
277
280
}
@@ -285,14 +288,14 @@ private func insertMarkDependencies(value: Value, initializer: Instruction?,
285
288
let markDep = builder. createMarkDependence (
286
289
value: currentValue, base: base, kind: . Unresolved)
287
290
288
- // Address dependencies cannot be represented as SSA values, so it does not make sense to replace any uses of the
289
- // dependent address.
290
- //
291
- // TODO: either (1) insert a separate mark_dependence_addr instruction with no return value, or (2) perform data
292
- // flow to replace all reachable address uses, and if any aren't dominated by base, then insert an extra
293
- // escaping mark_dependence at this apply site that directly uses the mark_dependence [nonescaping] to force
294
- // diagnostics to fail.
295
- if !value . type . isAddress {
291
+ if value . type . isAddress {
292
+ // Address dependencies cannot be represented as SSA values, so it does not make sense to replace any uses of the
293
+ // dependent address.
294
+ //
295
+ // TODO: insert a separate mark_dependence_addr instruction with no return value and do not update currentValue.
296
+ } else {
297
+ // TODO: implement non-inout parameter dependencies. This assumes that currentValue is the apply immediately
298
+ // preceeding the mark_dependence.
296
299
let uses = currentValue. uses. lazy. filter {
297
300
if $0. isScopeEndingUse {
298
301
return false
0 commit comments