Skip to content

Commit 71368be

Browse files
committed
[Gardening] SIL: "Liferange" -> "Liverange"
1 parent 87e4c65 commit 71368be

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/AllocVectorLowering.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ private extension StructInst {
190190
/// Lowers the allocateVector builtin either to an stack-allocated vector (`alloc_vector`)
191191
/// or to a statically initialized global.
192192
private func lower(allocVectorBuiltin: BuiltinInst, _ context: FunctionPassContext) {
193-
let visitor = ComputeNonEscapingLiferange(of: allocVectorBuiltin, context)
193+
let visitor = ComputeNonEscapingLiverange(of: allocVectorBuiltin, context)
194194

195195
guard let result = allocVectorBuiltin.visit(using: visitor, context) else {
196196
if allocVectorBuiltin.parentFunction.isTransparent {
@@ -336,7 +336,7 @@ private func findInitStores(of address: Value, atIndex: Int, _ initStores: inout
336336

337337
// This is very experimental and not ideal at all.
338338
// TODO: replace this with DiagnoseLifetimeDependence from https://github.com/apple/swift/pull/68682
339-
private struct ComputeNonEscapingLiferange : EscapeVisitorWithResult {
339+
private struct ComputeNonEscapingLiverange : EscapeVisitorWithResult {
340340

341341
enum Result {
342342
case liverange(InstructionRange)

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/RedundantLoadElimination.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private extension LoadInst {
161161
_ context: FunctionPassContext
162162
) -> DataflowResult {
163163

164-
var liverange = Liferange(endBlock: self.parentBlock, context)
164+
var liverange = Liverange(endBlock: self.parentBlock, context)
165165
defer { liverange.deinitialize() }
166166
liverange.pushPredecessors(of: self.parentBlock)
167167

@@ -184,7 +184,7 @@ private extension LoadInst {
184184
return .redundant(scanner.availableValues)
185185
}
186186

187-
func canReplaceWithoutInsertingCopies(liverange: Liferange,_ context: FunctionPassContext) -> Bool {
187+
func canReplaceWithoutInsertingCopies(liverange: Liverange,_ context: FunctionPassContext) -> Bool {
188188
switch self.loadOwnership {
189189
case .trivial, .unqualified:
190190
return true
@@ -536,7 +536,7 @@ private struct InstructionScanner {
536536
/// bb3:
537537
/// %3 = load %addr // end block
538538
///
539-
private struct Liferange {
539+
private struct Liverange {
540540
private var worklist: BasicBlockWorklist
541541
private var containingBlocks: Stack<BasicBlock> // doesn't include the end-block
542542
private var beginBlocks: BasicBlockSet

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/StackPromotion.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private func tryPromoteAlloc(_ allocRef: AllocRefInstBase,
146146

147147
// The "inner" liverange contains all use points which are dominated by the allocation block.
148148
// Note that this `visit` cannot fail because otherwise our initial `isEscaping` check would have failed already.
149-
var innerRange = allocRef.visit(using: ComputeInnerLiferange(of: allocRef, domTree, context), context)!
149+
var innerRange = allocRef.visit(using: ComputeInnerLiverange(of: allocRef, domTree, context), context)!
150150
defer { innerRange.deinitialize() }
151151

152152
// The "outer" liverange contains all use points.
@@ -236,7 +236,7 @@ private func getDominatingBlockOfAllUsePoints(context: FunctionPassContext,
236236
return value.visit(using: FindDominatingBlock(result: value.parentBlock, domTree: domTree), context)!
237237
}
238238

239-
private struct ComputeInnerLiferange : EscapeVisitorWithResult {
239+
private struct ComputeInnerLiverange : EscapeVisitorWithResult {
240240
var result: InstructionRange
241241
let domTree: DominatorTree
242242

lib/SILOptimizer/Transforms/TempLValueOpt.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void TempLValueOptPass::tempLValueOpt(CopyAddrInst *copyInst) {
128128
//
129129
// alloc_stack %temp
130130
// ...
131-
// first_use_of %temp // beginOfLiferange
131+
// first_use_of %temp // beginOfLiverange
132132
// ... // no reads or writes from/to %destination
133133
// copy_addr [take] %temp to %destination // copyInst
134134
// ... // no further uses of %temp (copyInst is the end of %temp liverange)
@@ -186,8 +186,8 @@ void TempLValueOptPass::tempLValueOpt(CopyAddrInst *copyInst) {
186186

187187
// Iterate over the liverange of the temporary and make some validity checks.
188188
AliasAnalysis *AA = nullptr;
189-
SILInstruction *beginOfLiferange = nullptr;
190-
bool endOfLiferangeReached = false;
189+
SILInstruction *beginOfLiverange = nullptr;
190+
bool endOfLiverangeReached = false;
191191
for (auto iter = temporary->getIterator(); iter != block->end(); ++iter) {
192192
SILInstruction *inst = &*iter;
193193
// The dealloc_stack is the last user of the temporary.
@@ -197,19 +197,19 @@ void TempLValueOptPass::tempLValueOpt(CopyAddrInst *copyInst) {
197197
if (users.contains(inst) != 0) {
198198
// Check if the copyInst is the last user of the temporary (beside the
199199
// dealloc_stack).
200-
if (endOfLiferangeReached)
200+
if (endOfLiverangeReached)
201201
return;
202202

203203
// Find the first user of the temporary to get a more precise liverange.
204204
// It would be too conservative to treat the alloc_stack itself as the
205205
// begin of the liverange.
206-
if (!beginOfLiferange)
207-
beginOfLiferange = inst;
206+
if (!beginOfLiverange)
207+
beginOfLiverange = inst;
208208

209209
if (inst == copyInst)
210-
endOfLiferangeReached = true;
210+
endOfLiverangeReached = true;
211211
}
212-
if (beginOfLiferange && !endOfLiferangeReached) {
212+
if (beginOfLiverange && !endOfLiverangeReached) {
213213
// If the root address of the destination is within the liverange of the
214214
// temporary, we cannot replace all uses of the temporary with the
215215
// destination (it would break the def-use dominance rule).
@@ -233,21 +233,21 @@ void TempLValueOptPass::tempLValueOpt(CopyAddrInst *copyInst) {
233233
return;
234234
}
235235
}
236-
assert(endOfLiferangeReached);
236+
assert(endOfLiverangeReached);
237237

238238
// Move all projections of the destination address before the liverange of
239239
// the temporary.
240-
for (auto iter = beginOfLiferange->getIterator();
240+
for (auto iter = beginOfLiverange->getIterator();
241241
iter != copyInst->getIterator();) {
242242
SILInstruction *inst = &*iter++;
243243
if (projections.contains(inst))
244-
inst->moveBefore(beginOfLiferange);
244+
inst->moveBefore(beginOfLiverange);
245245
}
246246

247247
if (!copyInst->isInitializationOfDest()) {
248248
// Make sure the destination is uninitialized before the liverange of
249249
// the temporary.
250-
SILBuilderWithScope builder(beginOfLiferange);
250+
SILBuilderWithScope builder(beginOfLiverange);
251251
builder.createDestroyAddr(copyInst->getLoc(), destination);
252252
}
253253

0 commit comments

Comments
 (0)