Skip to content

Commit df24019

Browse files
committed
Rename Cloner.cloneRecursivelyToGlobal.
1 parent e5b6a88 commit df24019

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/InitializeStaticGlobals.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ private indirect enum GlobalInitValue {
289289
fatalError("cannot materialize undefined init value")
290290

291291
case .constant(let value):
292-
return cloner.cloneRecursivelyToGlobal(value: value)
292+
return cloner.cloneRecursively(globalInitValue: value)
293293

294294
case .aggregate(let fields):
295295
if type.isStruct {

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ObjectOutliner.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ private func constructObject(of allocRef: AllocRefInstBase,
370370
// Create the initializers for the fields
371371
var objectArgs = [Value]()
372372
for store in storesToClassFields {
373-
objectArgs.append(cloner.cloneRecursivelyToGlobal(value: store.source as! SingleValueInstruction))
373+
objectArgs.append(cloner.cloneRecursively(globalInitValue: store.source as! SingleValueInstruction))
374374
}
375375
let globalBuilder = Builder(staticInitializerOf: global, context)
376376

@@ -382,15 +382,15 @@ private func constructObject(of allocRef: AllocRefInstBase,
382382
for elementIdx in 0..<allocRef.numTailElements! {
383383
let tupleElems = (0..<numTailTupleElems).map { tupleIdx in
384384
let store = storesToTailElements[elementIdx * numTailTupleElems + tupleIdx]
385-
return cloner.cloneRecursivelyToGlobal(value: store.source as! SingleValueInstruction)
385+
return cloner.cloneRecursively(globalInitValue: store.source as! SingleValueInstruction)
386386
}
387387
let tuple = globalBuilder.createTuple(type: allocRef.tailAllocatedTypes[0], elements: tupleElems)
388388
objectArgs.append(tuple)
389389
}
390390
} else {
391391
// The non-tuple element case.
392392
for store in storesToTailElements {
393-
objectArgs.append(cloner.cloneRecursivelyToGlobal(value: store.source as! SingleValueInstruction))
393+
objectArgs.append(cloner.cloneRecursively(globalInitValue: store.source as! SingleValueInstruction))
394394
}
395395
}
396396
}

SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyLoad.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ extension LoadInst : OnoneSimplifiable, SILCombineSimplifiable {
107107
var cloner = Cloner(cloneBefore: self, context)
108108
defer { cloner.deinitialize() }
109109

110-
let initVal = cloner.cloneRecursivelyToGlobal(value: globalInitVal)
110+
let initVal = cloner.cloneRecursively(globalInitValue: globalInitVal)
111111

112112
uses.replaceAll(with: initVal, context)
113113
// Also erases a builtin "once" on which the global_addr depends on. This is fine

SwiftCompilerSources/Sources/SIL/Utilities/Cloner.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ public struct Cloner<Context: MutatingContext> {
8989
}
9090
return cloned
9191
}
92-
93-
public mutating func cloneRecursivelyToGlobal(value: Value) -> Value {
94-
guard let cloned = cloneRecursively(value: value, customGetCloned: { value, cloner in
92+
93+
public mutating func cloneRecursively(globalInitValue: Value) -> Value {
94+
guard let cloned = cloneRecursively(value: globalInitValue, customGetCloned: { value, cloner in
9595
guard let beginAccess = value as? BeginAccessInst else {
9696
return .defaultValue
9797
}
9898

9999
// Skip access instructions, which might be generated for UnsafePointer globals which point to other globals.
100-
let clonedOperand = cloner.cloneRecursivelyToGlobal(value: beginAccess.address)
100+
let clonedOperand = cloner.cloneRecursively(globalInitValue: beginAccess.address)
101101
cloner.recordFoldedValue(beginAccess, mappedTo: clonedOperand)
102102
return .customValue(clonedOperand)
103103
}) else {

0 commit comments

Comments
 (0)