Skip to content

Commit 7bfd711

Browse files
committed
[Gardening] SIL: "LifeRange" -> "LiveRange"
1 parent 71368be commit 7bfd711

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ClosureSpecialization.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ private func gatherCallSites(in caller: Function, _ context: FunctionPassContext
192192

193193
private func updateCallSites(for rootClosure: SingleValueInstruction, in callSiteMap: inout CallSiteMap,
194194
convertedAndReabstractedClosures: inout InstructionSet, _ context: FunctionPassContext) {
195-
var rootClosurePossibleLifeRange = InstructionRange(begin: rootClosure, context)
195+
var rootClosurePossibleLiveRange = InstructionRange(begin: rootClosure, context)
196196
defer {
197-
rootClosurePossibleLifeRange.deinitialize()
197+
rootClosurePossibleLiveRange.deinitialize()
198198
}
199199

200200
var rootClosureApplies = OperandWorklist(context)
@@ -218,7 +218,7 @@ private func updateCallSites(for rootClosure: SingleValueInstruction, in callSit
218218

219219
let (foundUnexpectedUse, haveUsedReabstraction) =
220220
handleNonApplies(for: rootClosure, rootClosureApplies: &rootClosureApplies,
221-
rootClosurePossibleLifeRange: &rootClosurePossibleLifeRange, context);
221+
rootClosurePossibleLiveRange: &rootClosurePossibleLiveRange, context);
222222

223223

224224
if foundUnexpectedUse {
@@ -227,12 +227,12 @@ private func updateCallSites(for rootClosure: SingleValueInstruction, in callSit
227227

228228
let intermediateClosureArgDescriptorData =
229229
handleApplies(for: rootClosure, callSiteMap: &callSiteMap, rootClosureApplies: &rootClosureApplies,
230-
rootClosurePossibleLifeRange: &rootClosurePossibleLifeRange,
230+
rootClosurePossibleLiveRange: &rootClosurePossibleLiveRange,
231231
convertedAndReabstractedClosures: &convertedAndReabstractedClosures,
232232
haveUsedReabstraction: haveUsedReabstraction, context)
233233

234234
finalizeCallSites(for: rootClosure, in: &callSiteMap,
235-
rootClosurePossibleLifeRange: rootClosurePossibleLifeRange,
235+
rootClosurePossibleLiveRange: rootClosurePossibleLiveRange,
236236
intermediateClosureArgDescriptorData: intermediateClosureArgDescriptorData, context)
237237
}
238238

@@ -244,7 +244,7 @@ private func updateCallSites(for rootClosure: SingleValueInstruction, in callSit
244244
/// how to handle. If true, then `rootClosure` should not be specialized against.
245245
private func handleNonApplies(for rootClosure: SingleValueInstruction,
246246
rootClosureApplies: inout OperandWorklist,
247-
rootClosurePossibleLifeRange: inout InstructionRange,
247+
rootClosurePossibleLiveRange: inout InstructionRange,
248248
_ context: FunctionPassContext)
249249
-> (foundUnexpectedUse: Bool, haveUsedReabstraction: Bool)
250250
{
@@ -295,12 +295,12 @@ private func handleNonApplies(for rootClosure: SingleValueInstruction,
295295
case let cfi as ConvertFunctionInst:
296296
rootClosureConversionsAndReabstractions.pushIfNotVisited(contentsOf: cfi.uses)
297297
possibleMarkDependenceBases.insert(cfi)
298-
rootClosurePossibleLifeRange.insert(use.instruction)
298+
rootClosurePossibleLiveRange.insert(use.instruction)
299299

300300
case let cvt as ConvertEscapeToNoEscapeInst:
301301
rootClosureConversionsAndReabstractions.pushIfNotVisited(contentsOf: cvt.uses)
302302
possibleMarkDependenceBases.insert(cvt)
303-
rootClosurePossibleLifeRange.insert(use.instruction)
303+
rootClosurePossibleLiveRange.insert(use.instruction)
304304

305305
case let pai as PartialApplyInst:
306306
if !pai.isPullbackInResultOfAutodiffVJP,
@@ -311,7 +311,7 @@ private func handleNonApplies(for rootClosure: SingleValueInstruction,
311311
{
312312
rootClosureConversionsAndReabstractions.pushIfNotVisited(contentsOf: pai.uses)
313313
possibleMarkDependenceBases.insert(pai)
314-
rootClosurePossibleLifeRange.insert(use.instruction)
314+
rootClosurePossibleLiveRange.insert(use.instruction)
315315
haveUsedReabstraction = true
316316
} else {
317317
rootClosureApplies.pushIfNotVisited(use)
@@ -320,15 +320,15 @@ private func handleNonApplies(for rootClosure: SingleValueInstruction,
320320
case let mv as MoveValueInst:
321321
rootClosureConversionsAndReabstractions.pushIfNotVisited(contentsOf: mv.uses)
322322
possibleMarkDependenceBases.insert(mv)
323-
rootClosurePossibleLifeRange.insert(use.instruction)
323+
rootClosurePossibleLiveRange.insert(use.instruction)
324324

325325
// Uses of a copy of root-closure do not count as
326326
// uses of the root-closure
327327
case is CopyValueInst:
328-
rootClosurePossibleLifeRange.insert(use.instruction)
328+
rootClosurePossibleLiveRange.insert(use.instruction)
329329

330330
case is DestroyValueInst:
331-
rootClosurePossibleLifeRange.insert(use.instruction)
331+
rootClosurePossibleLiveRange.insert(use.instruction)
332332

333333
case let mdi as MarkDependenceInst:
334334
if possibleMarkDependenceBases.contains(mdi.base),
@@ -337,7 +337,7 @@ private func handleNonApplies(for rootClosure: SingleValueInstruction,
337337
mdi.value.type.isThickFunction
338338
{
339339
rootClosureConversionsAndReabstractions.pushIfNotVisited(contentsOf: mdi.uses)
340-
rootClosurePossibleLifeRange.insert(use.instruction)
340+
rootClosurePossibleLiveRange.insert(use.instruction)
341341
}
342342

343343
default:
@@ -354,14 +354,14 @@ private typealias IntermediateClosureArgDescriptorDatum = (applySite: SingleValu
354354

355355
private func handleApplies(for rootClosure: SingleValueInstruction, callSiteMap: inout CallSiteMap,
356356
rootClosureApplies: inout OperandWorklist,
357-
rootClosurePossibleLifeRange: inout InstructionRange,
357+
rootClosurePossibleLiveRange: inout InstructionRange,
358358
convertedAndReabstractedClosures: inout InstructionSet, haveUsedReabstraction: Bool,
359359
_ context: FunctionPassContext) -> [IntermediateClosureArgDescriptorDatum]
360360
{
361361
var intermediateClosureArgDescriptorData: [IntermediateClosureArgDescriptorDatum] = []
362362

363363
while let use = rootClosureApplies.pop() {
364-
rootClosurePossibleLifeRange.insert(use.instruction)
364+
rootClosurePossibleLiveRange.insert(use.instruction)
365365

366366
// TODO [extend to general swift]: Handle full apply sites
367367
guard let pai = use.instruction as? PartialApplyInst else {
@@ -479,11 +479,11 @@ private func handleApplies(for rootClosure: SingleValueInstruction, callSiteMap:
479479
/// Finalizes the call sites for a given root closure by adding a corresponding `ClosureArgDescriptor`
480480
/// to all call sites where the closure is ultimately passed as an argument.
481481
private func finalizeCallSites(for rootClosure: SingleValueInstruction, in callSiteMap: inout CallSiteMap,
482-
rootClosurePossibleLifeRange: InstructionRange,
482+
rootClosurePossibleLiveRange: InstructionRange,
483483
intermediateClosureArgDescriptorData: [IntermediateClosureArgDescriptorDatum],
484484
_ context: FunctionPassContext)
485485
{
486-
let closureInfo = ClosureInfo(closure: rootClosure, lifetimeFrontier: Array(rootClosurePossibleLifeRange.ends))
486+
let closureInfo = ClosureInfo(closure: rootClosure, lifetimeFrontier: Array(rootClosurePossibleLiveRange.ends))
487487

488488
for (applySite, closureArgumentIndex, parameterInfo) in intermediateClosureArgDescriptorData {
489489
guard var callSite = callSiteMap[applySite] else {

0 commit comments

Comments
 (0)