@@ -181,63 +181,3 @@ private func insertMarkDependencies(value: Value, initializer: Instruction?,
181
181
currentValue = markDep
182
182
}
183
183
}
184
-
185
- /*
186
- /// Return base values that this return value depends on.
187
- ///
188
- /// For lifetime copies, walk up the dependence chain to find the
189
- /// dependence roots, inserting dependencies for any
190
- /// LifetimeDependentApply.
191
- private func recursivelyFindDependenceBases(of apply: LifetimeDependentApply,
192
- _ context: FunctionPassContext)
193
- -> [Value] {
194
- log("Creating dependencies for \(apply.applySite)")
195
- var bases: [Value] = []
196
- for lifetimeArg in apply.getLifetimeArguments() {
197
- switch lifetimeArg.convention {
198
- case .inherit:
199
- // Inherit the argument's lifetime dependence by finding the
200
- // roots. This requires that a mark_dependence [nonescaping]
201
- // already be created for any earlier LifetimeDependentApply.
202
- _ = LifetimeDependence.visitDependenceRoots(enclosing: lifetimeArg.value,
203
- context)
204
- { (scope: LifetimeDependence.Scope) in
205
- if let updatedScope = recursivelyUpdate(scope: scope, context) {
206
- log("Inherited lifetime from \(lifetimeArg.value)")
207
- log(" depends on: \(updatedScope)")
208
- bases.append(updatedScope.parentValue)
209
- }
210
- return .continueWalk
211
- }
212
- case .scope:
213
- // Create a new dependence on the apply's access to the argument.
214
- if let scope =
215
- LifetimeDependence.Scope(base: lifetimeArg.value, context) {
216
- log("Scoped lifetime from \(lifetimeArg.value)")
217
- log(" scope: \(scope)")
218
- bases.append(scope.parentValue)
219
- }
220
- }
221
- }
222
- return bases
223
- }
224
-
225
- // Recursively insert dependencies, assuming no cycle of dependent applies.
226
- //
227
- // TODO: needs unit test.
228
- private func recursivelyUpdate(scope: LifetimeDependence.Scope,
229
- _ context: FunctionPassContext) -> LifetimeDependence.Scope? {
230
- if let dependentApply =
231
- LifetimeDependentApply(withResult: scope.parentValue) {
232
- insertDependencies(for: dependentApply, context)
233
- // If a mark_dependence [nonescaping] was created for this apply,
234
- // then return it as the updated dependence. Otherwise, return the
235
- // original dependence.
236
- if let markDep = scope.parentValue.uses.singleUse?.instruction
237
- as? MarkDependenceInst {
238
- return LifetimeDependence(markDep, context)?.scope
239
- }
240
- }
241
- return scope
242
- }
243
- */
0 commit comments