@@ -192,9 +192,9 @@ private func gatherCallSites(in caller: Function, _ context: FunctionPassContext
192
192
193
193
private func updateCallSites( for rootClosure: SingleValueInstruction , in callSiteMap: inout CallSiteMap ,
194
194
convertedAndReabstractedClosures: inout InstructionSet , _ context: FunctionPassContext ) {
195
- var rootClosurePossibleLifeRange = InstructionRange ( begin: rootClosure, context)
195
+ var rootClosurePossibleLiveRange = InstructionRange ( begin: rootClosure, context)
196
196
defer {
197
- rootClosurePossibleLifeRange . deinitialize ( )
197
+ rootClosurePossibleLiveRange . deinitialize ( )
198
198
}
199
199
200
200
var rootClosureApplies = OperandWorklist ( context)
@@ -218,7 +218,7 @@ private func updateCallSites(for rootClosure: SingleValueInstruction, in callSit
218
218
219
219
let ( foundUnexpectedUse, haveUsedReabstraction) =
220
220
handleNonApplies ( for: rootClosure, rootClosureApplies: & rootClosureApplies,
221
- rootClosurePossibleLifeRange : & rootClosurePossibleLifeRange , context) ;
221
+ rootClosurePossibleLiveRange : & rootClosurePossibleLiveRange , context) ;
222
222
223
223
224
224
if foundUnexpectedUse {
@@ -227,12 +227,12 @@ private func updateCallSites(for rootClosure: SingleValueInstruction, in callSit
227
227
228
228
let intermediateClosureArgDescriptorData =
229
229
handleApplies ( for: rootClosure, callSiteMap: & callSiteMap, rootClosureApplies: & rootClosureApplies,
230
- rootClosurePossibleLifeRange : & rootClosurePossibleLifeRange ,
230
+ rootClosurePossibleLiveRange : & rootClosurePossibleLiveRange ,
231
231
convertedAndReabstractedClosures: & convertedAndReabstractedClosures,
232
232
haveUsedReabstraction: haveUsedReabstraction, context)
233
233
234
234
finalizeCallSites ( for: rootClosure, in: & callSiteMap,
235
- rootClosurePossibleLifeRange : rootClosurePossibleLifeRange ,
235
+ rootClosurePossibleLiveRange : rootClosurePossibleLiveRange ,
236
236
intermediateClosureArgDescriptorData: intermediateClosureArgDescriptorData, context)
237
237
}
238
238
@@ -244,7 +244,7 @@ private func updateCallSites(for rootClosure: SingleValueInstruction, in callSit
244
244
/// how to handle. If true, then `rootClosure` should not be specialized against.
245
245
private func handleNonApplies( for rootClosure: SingleValueInstruction ,
246
246
rootClosureApplies: inout OperandWorklist ,
247
- rootClosurePossibleLifeRange : inout InstructionRange ,
247
+ rootClosurePossibleLiveRange : inout InstructionRange ,
248
248
_ context: FunctionPassContext )
249
249
-> ( foundUnexpectedUse: Bool , haveUsedReabstraction: Bool )
250
250
{
@@ -295,12 +295,12 @@ private func handleNonApplies(for rootClosure: SingleValueInstruction,
295
295
case let cfi as ConvertFunctionInst :
296
296
rootClosureConversionsAndReabstractions. pushIfNotVisited ( contentsOf: cfi. uses)
297
297
possibleMarkDependenceBases. insert ( cfi)
298
- rootClosurePossibleLifeRange . insert ( use. instruction)
298
+ rootClosurePossibleLiveRange . insert ( use. instruction)
299
299
300
300
case let cvt as ConvertEscapeToNoEscapeInst :
301
301
rootClosureConversionsAndReabstractions. pushIfNotVisited ( contentsOf: cvt. uses)
302
302
possibleMarkDependenceBases. insert ( cvt)
303
- rootClosurePossibleLifeRange . insert ( use. instruction)
303
+ rootClosurePossibleLiveRange . insert ( use. instruction)
304
304
305
305
case let pai as PartialApplyInst :
306
306
if !pai. isPullbackInResultOfAutodiffVJP,
@@ -311,7 +311,7 @@ private func handleNonApplies(for rootClosure: SingleValueInstruction,
311
311
{
312
312
rootClosureConversionsAndReabstractions. pushIfNotVisited ( contentsOf: pai. uses)
313
313
possibleMarkDependenceBases. insert ( pai)
314
- rootClosurePossibleLifeRange . insert ( use. instruction)
314
+ rootClosurePossibleLiveRange . insert ( use. instruction)
315
315
haveUsedReabstraction = true
316
316
} else {
317
317
rootClosureApplies. pushIfNotVisited ( use)
@@ -320,15 +320,15 @@ private func handleNonApplies(for rootClosure: SingleValueInstruction,
320
320
case let mv as MoveValueInst :
321
321
rootClosureConversionsAndReabstractions. pushIfNotVisited ( contentsOf: mv. uses)
322
322
possibleMarkDependenceBases. insert ( mv)
323
- rootClosurePossibleLifeRange . insert ( use. instruction)
323
+ rootClosurePossibleLiveRange . insert ( use. instruction)
324
324
325
325
// Uses of a copy of root-closure do not count as
326
326
// uses of the root-closure
327
327
case is CopyValueInst :
328
- rootClosurePossibleLifeRange . insert ( use. instruction)
328
+ rootClosurePossibleLiveRange . insert ( use. instruction)
329
329
330
330
case is DestroyValueInst :
331
- rootClosurePossibleLifeRange . insert ( use. instruction)
331
+ rootClosurePossibleLiveRange . insert ( use. instruction)
332
332
333
333
case let mdi as MarkDependenceInst :
334
334
if possibleMarkDependenceBases. contains ( mdi. base) ,
@@ -337,7 +337,7 @@ private func handleNonApplies(for rootClosure: SingleValueInstruction,
337
337
mdi. value. type. isThickFunction
338
338
{
339
339
rootClosureConversionsAndReabstractions. pushIfNotVisited ( contentsOf: mdi. uses)
340
- rootClosurePossibleLifeRange . insert ( use. instruction)
340
+ rootClosurePossibleLiveRange . insert ( use. instruction)
341
341
}
342
342
343
343
default :
@@ -354,14 +354,14 @@ private typealias IntermediateClosureArgDescriptorDatum = (applySite: SingleValu
354
354
355
355
private func handleApplies( for rootClosure: SingleValueInstruction , callSiteMap: inout CallSiteMap ,
356
356
rootClosureApplies: inout OperandWorklist ,
357
- rootClosurePossibleLifeRange : inout InstructionRange ,
357
+ rootClosurePossibleLiveRange : inout InstructionRange ,
358
358
convertedAndReabstractedClosures: inout InstructionSet , haveUsedReabstraction: Bool ,
359
359
_ context: FunctionPassContext ) -> [ IntermediateClosureArgDescriptorDatum ]
360
360
{
361
361
var intermediateClosureArgDescriptorData : [ IntermediateClosureArgDescriptorDatum ] = [ ]
362
362
363
363
while let use = rootClosureApplies. pop ( ) {
364
- rootClosurePossibleLifeRange . insert ( use. instruction)
364
+ rootClosurePossibleLiveRange . insert ( use. instruction)
365
365
366
366
// TODO [extend to general swift]: Handle full apply sites
367
367
guard let pai = use. instruction as? PartialApplyInst else {
@@ -479,11 +479,11 @@ private func handleApplies(for rootClosure: SingleValueInstruction, callSiteMap:
479
479
/// Finalizes the call sites for a given root closure by adding a corresponding `ClosureArgDescriptor`
480
480
/// to all call sites where the closure is ultimately passed as an argument.
481
481
private func finalizeCallSites( for rootClosure: SingleValueInstruction , in callSiteMap: inout CallSiteMap ,
482
- rootClosurePossibleLifeRange : InstructionRange ,
482
+ rootClosurePossibleLiveRange : InstructionRange ,
483
483
intermediateClosureArgDescriptorData: [ IntermediateClosureArgDescriptorDatum ] ,
484
484
_ context: FunctionPassContext )
485
485
{
486
- let closureInfo = ClosureInfo ( closure: rootClosure, lifetimeFrontier: Array ( rootClosurePossibleLifeRange . ends) )
486
+ let closureInfo = ClosureInfo ( closure: rootClosure, lifetimeFrontier: Array ( rootClosurePossibleLiveRange . ends) )
487
487
488
488
for (applySite, closureArgumentIndex, parameterInfo) in intermediateClosureArgDescriptorData {
489
489
guard var callSite = callSiteMap [ applySite] else {
0 commit comments