Skip to content

Commit c18a24e

Browse files
authored
[SwiftCompilerSources] Fix typos
1 parent ffba6d1 commit c18a24e

21 files changed

+44
-44
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/AsyncDemotion.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ private func analyzeForDemotion(_ function: Function) -> Node? {
590590
// because it may be a caller of a function that can be demoted.
591591

592592
var executors = Set<Executor>()
593-
var knownAsyncApplys: [ApplySite] = []
593+
var knownAsyncApplySites: [ApplySite] = []
594594
var hops: [Instruction] = []
595595
var unknownAsyncOp: Instruction? = nil
596596

@@ -614,7 +614,7 @@ private func analyzeForDemotion(_ function: Function) -> Node? {
614614
if apply.referencedFunction == nil {
615615
unknownAsyncOp.setIfUnset(inst)
616616
} else {
617-
knownAsyncApplys.append(apply)
617+
knownAsyncApplySites.append(apply)
618618
stats.tick(.asyncKnownCallsCount)
619619
}
620620

@@ -630,7 +630,7 @@ private func analyzeForDemotion(_ function: Function) -> Node? {
630630

631631
let data: AnalysisResult.Data =
632632
(function: function,
633-
knownAsyncCalls: knownAsyncApplys,
633+
knownAsyncCalls: knownAsyncApplySites,
634634
executors: executors,
635635
hops: hops)
636636

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ComputeSideEffects.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private struct CollectedEffects {
145145
// In addition to the effects of the apply, also consider the
146146
// effects of the capture, which reads the captured value in
147147
// order to move it into the context. This only applies to
148-
// addressible values, because capturing does not dereference
148+
// addressable values, because capturing does not dereference
149149
// any class objects.
150150
//
151151
// Ignore captures for on-stack partial applies. They only
@@ -332,7 +332,7 @@ private struct CollectedEffects {
332332
/// Adds effects to a specific value.
333333
///
334334
/// If the value comes from an argument (or multiple arguments), then the effects are added
335-
/// to the corrseponding `argumentEffects`. Otherwise they are added to the `global` effects.
335+
/// to the corresponding `argumentEffects`. Otherwise they are added to the `global` effects.
336336
private mutating func addEffects(_ effects: SideEffects.GlobalEffects, to value: Value) {
337337
addEffects(effects, to: value, fromInitialPath: defaultPath(for: value))
338338
}

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceScopeFixup.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private func extendAccessScopes(dependence: LifetimeDependence,
112112
/// caller scope, which is handled separately). A nested 'read' access can never interfere with another access in the
113113
/// same outer 'read', because it is impossible to nest a 'modify' access within a 'read'. For 'modify' accesses,
114114
/// however, the inner scope must be extended for correctness. A 'modify' access can interfere with other 'modify'
115-
/// accesss in the same scope. We rely on exclusivity diagnostics to report these interferences. For example:
115+
/// access in the same scope. We rely on exclusivity diagnostics to report these interferences. For example:
116116
///
117117
/// sil @foo : $(@inout C) -> () {
118118
/// bb0(%0 : $*C):
@@ -133,12 +133,12 @@ private func extendAccessScopes(dependence: LifetimeDependence,
133133
/// violation, and that subsequent optimizations do not shrink the inner access `%a1`.
134134
private func extendAccessScope(beginAccess: BeginAccessInst, range: inout InstructionRange,
135135
_ context: FunctionPassContext) -> FunctionArgument? {
136-
var endAcceses = [Instruction]()
136+
var endAccesses = [Instruction]()
137137
// Collect the original end_access instructions and extend the range to to cover them. The resulting access scope must
138138
// cover the original scope because it may protect other memory operations.
139139
var requiresExtension = false
140140
for end in beginAccess.endInstructions {
141-
endAcceses.append(end)
141+
endAccesses.append(end)
142142
if range.contains(end) {
143143
// If any end_access is inside the new range, then all end_accesses must be rewritten.
144144
requiresExtension = true
@@ -171,7 +171,7 @@ private func extendAccessScope(beginAccess: BeginAccessInst, range: inout Instru
171171
range.insert(endAccess)
172172
}
173173
// Delete original end_access instructions
174-
for endAccess in endAcceses {
174+
for endAccess in endAccesses {
175175
context.erase(instruction: endAccess)
176176
}
177177
// TODO: Add SIL support for lifetime dependence and write unit test for nested access scopes

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/StackPromotion.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ private struct ComputeOuterBlockrange : EscapeVisitorWithResult {
273273
// instructions (for which the `visitUse` closure is not called).
274274
result.insert(operandsDefinitionBlock)
275275

276-
// We need to explicitly add predecessor blocks of phis becaues they
276+
// We need to explicitly add predecessor blocks of phis because they
277277
// are not necesesarily visited during the down-walk in `isEscaping()`.
278278
// This is important for the special case where there is a back-edge from the
279279
// inner range to the inner rage's begin-block:

SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyBeginBorrow.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private extension Instruction {
132132
// In instruction simplification we don't have a domtree. Therefore do a simple dominance
133133
// check based on same-block relations.
134134
if parentBlock == value.parentBlock {
135-
// The value and instruction are in the same block. All uses are dominanted by both.
135+
// The value and instruction are in the same block. All uses are dominated by both.
136136
return true
137137
}
138138
let destroys = value.uses.filterUsers(ofType: DestroyValueInst.self)

SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyLoad.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extension LoadInst : OnoneSimplifyable, SILCombineSimplifyable {
2020
if optimizeLoadFromStringLiteral(context) {
2121
return
2222
}
23-
if optmizeLoadFromEmptyCollection(context) {
23+
if optimizeLoadFromEmptyCollection(context) {
2424
return
2525
}
2626
if replaceLoadOfGlobalLet(context) {
@@ -85,7 +85,7 @@ extension LoadInst : OnoneSimplifyable, SILCombineSimplifyable {
8585

8686
/// Loading `count` or `capacity` from the empty `Array`, `Set` or `Dictionary` singleton
8787
/// is replaced by a 0 literal.
88-
private func optmizeLoadFromEmptyCollection(_ context: SimplifyContext) -> Bool {
88+
private func optimizeLoadFromEmptyCollection(_ context: SimplifyContext) -> Bool {
8989
if self.isZeroLoadFromEmptyCollection() {
9090
let builder = Builder(before: self, context)
9191
let zeroLiteral = builder.createIntegerLiteral(0, type: type)

SwiftCompilerSources/Sources/Optimizer/PassManager/Context.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ extension MutatingContext {
184184
}
185185

186186
func inlineFunction(apply: FullApplySite, mandatoryInline: Bool) {
187-
// This is only a best-effort attempt to notity the new cloned instructions as changed.
187+
// This is only a best-effort attempt to notify the new cloned instructions as changed.
188188
// TODO: get a list of cloned instructions from the `inlineFunction`
189189
let instAfterInling: Instruction?
190190
switch apply {

SwiftCompilerSources/Sources/Optimizer/Utilities/AddressUtils.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ extension AddressUseVisitor {
194194
if operand.instruction.isIncidentalUse {
195195
return leafAddressUse(of: operand)
196196
}
197-
// Unkown instruction.
197+
// Unknown instruction.
198198
return unknownAddressUse(of: operand)
199199
}
200200
}
@@ -289,7 +289,7 @@ extension AddressInitializationWalker {
289289
}
290290
}
291291

292-
// Implement AddresUseVisitor
292+
// Implement AddressUseVisitor
293293
extension AddressInitializationWalker {
294294
/// An address projection produces a single address result and does not
295295
/// escape its address operand in any other way.
@@ -359,7 +359,7 @@ extension AddressInitializationWalker {
359359
}
360360
}
361361

362-
/// A live range representing the ownership of addressible memory.
362+
/// A live range representing the ownership of addressable memory.
363363
///
364364
/// This live range represents the minimal guaranteed lifetime of the object being addressed. Uses of derived addresses
365365
/// may be extended up to the ends of this scope without violating ownership.

SwiftCompilerSources/Sources/Optimizer/Utilities/BorrowUtils.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
//
127127
//
128128
// TODO: These utilities should be integrated with OSSA SIL verification and
129-
// guaranteed to be compelete (produce known results for all legal SIL
129+
// guaranteed to be complete (produce known results for all legal SIL
130130
// patterns).
131131
// ===----------------------------------------------------------------------===//
132132

@@ -211,7 +211,7 @@ enum BorrowingInstruction : CustomStringConvertible, Hashable {
211211
/// the last in the function (e.g. a store rather than a destroy or return).
212212
/// The client needs to use LifetimeDependenceDefUseWalker to do better.
213213
///
214-
/// TODO: to hande reborrow-extended uses, migrate ExtendedLiveness
214+
/// TODO: to handle reborrow-extended uses, migrate ExtendedLiveness
215215
/// to SwiftCompilerSources.
216216
///
217217
/// TODO: Handle .partialApply and .markDependence forwarded uses
@@ -278,7 +278,7 @@ enum BorrowingInstruction : CustomStringConvertible, Hashable {
278278
///
279279
/// If the value is a begin_apply result, then it may be the token or
280280
/// one of the yielded values. In any case, the scope ending operands
281-
/// are on the end_apply or abort_apply intructions that use the
281+
/// are on the end_apply or abort_apply instructions that use the
282282
/// token.
283283
///
284284
/// Note: equivalent to C++ BorrowedValue, but also handles begin_apply.

SwiftCompilerSources/Sources/Optimizer/Utilities/EscapeUtils.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ protocol EscapeVisitor {
156156
/// If true, the traversals follow values with trivial types.
157157
var followTrivialTypes: Bool { get }
158158

159-
/// If true, the traveral follows loaded values.
159+
/// If true, the traversal follows loaded values.
160160
var followLoads: Bool { get }
161161
}
162162

SwiftCompilerSources/Sources/Optimizer/Utilities/LifetimeDependenceUtils.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ struct LifetimeDependence : CustomStringConvertible {
113113
case yield(Value)
114114
/// An owned value whose OSSA lifetime encloses nonescapable values
115115
case owned(Value)
116-
/// Singly-initialized addressible storage (likely for an
116+
/// Singly-initialized addressable storage (likely for an
117117
/// immutable address-only value). The lifetime extends until the
118118
/// memory is destroyed. e.g. A value produced by an @in
119119
/// FunctionArgument or @out apply. @inout has caller scope
@@ -559,7 +559,7 @@ extension LifetimeDependence {
559559
/// This uses LifetimeDependenceUseDefWalker to find the introducers
560560
/// of a dependence chain, which represent the value's "inherited"
561561
/// dependencies. This stops at an address, unless the address refers
562-
/// to a singly-initialized temprorary, in which case it continues to
562+
/// to a singly-initialized temporary, in which case it continues to
563563
/// walk up the stored value.
564564
///
565565
/// This overrides LifetimeDependenceUseDefWalker to stop at a value
@@ -773,7 +773,7 @@ extension LifetimeDependenceUseDefWalker {
773773
/// follows interior pointers using AddressUseVisitor. Handles stores to and loads from local variables using
774774
/// LocalVariableReachabilityCache.
775775
///
776-
/// Ignores trivial values (~Escapable types are never trivial. Escapable types may only be lifetime-depenent values if
776+
/// Ignores trivial values (~Escapable types are never trivial. Escapable types may only be lifetime-dependent values if
777777
/// they are non-trivial).
778778
///
779779
/// Skips uses within nested borrow scopes.

SwiftCompilerSources/Sources/Optimizer/Utilities/LocalVariableUtils.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212
///
13-
/// SIL operates on three kinds of addressible memory:
13+
/// SIL operates on three kinds of addressable memory:
1414
///
1515
/// 1. Temporary RValues. These are recognied by AddressInitializationWalker. These largely disappear with opaque SIL
1616
/// values.
@@ -35,13 +35,13 @@ private func log(_ message: @autoclosure () -> String) {
3535

3636
// Local variables are accessed in one of these ways.
3737
//
38-
// Note: @in is only immutable up to when it is destroyed, so still requies a local live range.
38+
// Note: @in is only immutable up to when it is destroyed, so still requires a local live range.
3939
struct LocalVariableAccess: CustomStringConvertible {
4040
enum Kind {
4141
case incomingArgument // @in, @inout, @inout_aliasable
4242
case outgoingArgument // @inout, @inout_aliasable
4343
case inoutYield // indirect yield from this accessor
44-
case beginAccess // Reading or reassinging a 'var'
44+
case beginAccess // Reading or reassigning a 'var'
4545
case load // Reading a 'let'. Returning 'var' from an initializer.
4646
case store // 'var' initialization and destruction
4747
case apply // indirect arguments
@@ -214,7 +214,7 @@ class LocalVariableAccessInfo: CustomStringConvertible {
214214
}
215215
}
216216

217-
/// Model the formal accesses of an addressible variable introduced by an alloc_box, alloc_stack, or indirect
217+
/// Model the formal accesses of an addressable variable introduced by an alloc_box, alloc_stack, or indirect
218218
/// FunctionArgument.
219219
///
220220
/// This instantiates a unique LocalVariableAccessInfo instances for each access instruction, caching it an an access

SwiftCompilerSources/Sources/Optimizer/Utilities/OptUtils.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ extension BasicBlock {
554554

555555
extension SimplifyContext {
556556

557-
/// Replaces a pair of redudant instructions, like
557+
/// Replaces a pair of redundant instructions, like
558558
/// ```
559559
/// %first = enum $E, #E.CaseA!enumelt, %replacement
560560
/// %second = unchecked_enum_data %first : $E, #E.CaseA!enumelt

SwiftCompilerSources/Sources/Optimizer/Utilities/OwnershipLiveness.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,10 @@ protocol OwnershipUseVisitor {
275275
mutating func pointerEscapingUse(of operand: Operand) -> WalkResult
276276

277277
/// A use that creates an implicit borrow scope over the lifetime of
278-
/// an owned dependent value. The operand owership is .borrow, but
278+
/// an owned dependent value. The operand ownership is .borrow, but
279279
/// there are no explicit scope-ending operations. Instead
280280
/// BorrowingInstruction.scopeEndingOperands will return the final
281-
/// consumes in the dependent value's forwaring chain.
281+
/// consumes in the dependent value's forwarding chain.
282282
mutating func dependentUse(of operand: Operand, into value: Value)
283283
-> WalkResult
284284

@@ -490,7 +490,7 @@ extension OwnershipUseVisitor {
490490
///
491491
/// - Does not assume the current lifetime is linear. Transitively
492492
/// follows guaranteed forwarding and address uses within the current
493-
/// scope. Phis that are not dominanted by definingValue or an outer
493+
/// scope. Phis that are not dominated by definingValue or an outer
494494
/// adjacent phi are marked "unenclosed" to signal an incomplete
495495
/// lifetime.
496496
///

SwiftCompilerSources/Sources/Optimizer/Utilities/Verifier.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import SIL
1414
import OptimizerBridging
1515

16-
private protocol VerifyableInstruction : Instruction {
16+
private protocol VerifiableInstruction : Instruction {
1717
func verify(_ context: FunctionPassContext)
1818
}
1919

@@ -36,8 +36,8 @@ extension Function {
3636

3737
inst.checkForwardingConformance()
3838

39-
if let verifyableInst = inst as? VerifyableInstruction {
40-
verifyableInst.verify(context)
39+
if let verifiableInst = inst as? VerifiableInstruction {
40+
verifiableInst.verify(context)
4141
}
4242
}
4343
}
@@ -54,7 +54,7 @@ private extension Instruction {
5454
}
5555
}
5656

57-
extension BorrowedFromInst : VerifyableInstruction {
57+
extension BorrowedFromInst : VerifiableInstruction {
5858
func verify(_ context: FunctionPassContext) {
5959
var computedEVs = Stack<Value>(context)
6060
defer { computedEVs.deinitialize() }

SwiftCompilerSources/Sources/SIL/Effects.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ extension Function {
162162
}
163163
if isProgramTerminationPoint {
164164
// We can ignore any memory writes in a program termination point, because it's not relevant
165-
// for the caller. But we need to consider memory reads, otherwise preceeding memory writes
165+
// for the caller. But we need to consider memory reads, otherwise preceding memory writes
166166
// would be eliminated by dead-store-elimination in the caller. E.g. String initialization
167167
// for error strings which are printed by the program termination point.
168168
// Regarding ownership: a program termination point must not touch any reference counted objects.
@@ -394,7 +394,7 @@ public struct SideEffects : CustomStringConvertible, NoReflectionChildren {
394394

395395
/// Returns the effects of an argument.
396396
///
397-
/// In constrast to using `arguments` directly, it's valid to have an `argumentIndex`
397+
/// In contrast to using `arguments` directly, it's valid to have an `argumentIndex`
398398
/// which is larger than the number of elements in `arguments`.
399399
public func getArgumentEffects(for argumentIndex: Int) -> ArgumentEffects {
400400
if argumentIndex < arguments.count {
@@ -430,7 +430,7 @@ public struct SideEffects : CustomStringConvertible, NoReflectionChildren {
430430

431431
/// Side-effects of a specific function argument.
432432
///
433-
/// The paths describe what (projeted) values of an argument are affected.
433+
/// The paths describe what (projected) values of an argument are affected.
434434
/// If a path is nil, than there is no such effect on the argument.
435435
///
436436
/// A path can contain any projection or wildcards, as long as there is no load involved.

SwiftCompilerSources/Sources/SIL/Operand.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public struct OperandArray : RandomAccessCollection, CustomReflectable {
8787

8888
/// Returns a sub-array defined by `bounds`.
8989
///
90-
/// Note: this does not return a Slice. The first index of the returnd array is always 0.
90+
/// Note: this does not return a Slice. The first index of the returned array is always 0.
9191
public subscript(bounds: Range<Int>) -> OperandArray {
9292
assert(bounds.lowerBound >= startIndex && bounds.upperBound <= endIndex)
9393
return OperandArray(

SwiftCompilerSources/Sources/SIL/Utilities/AccessUtils.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public struct AccessPath : CustomStringConvertible {
335335
/// Returns true if this access addresses the same memory location as `other` or if `other`
336336
/// is a sub-field of this access.
337337

338-
/// Note that this access _contains_ `other` if `other` has a _larger_ projection path than this acccess.
338+
/// Note that this access _contains_ `other` if `other` has a _larger_ projection path than this access.
339339
/// For example:
340340
/// `%value.s0` contains `%value.s0.s1`
341341
public func isEqualOrContains(_ other: AccessPath) -> Bool {

SwiftCompilerSources/Sources/SIL/Utilities/WalkUtils.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ extension AddressDefUseWalker {
570570
/// to reflect that a further projection is needed to reach the value of interest from the new initial value.
571571
/// 2. If the instruction of the definition is a value construction such as `struct` and
572572
/// the head of the path matches the instruction type then the walk continues
573-
/// with a call to `walkUp` with initial value the operand defintion denoted by the path
573+
/// with a call to `walkUp` with initial value the operand definition denoted by the path
574574
/// and the suffix path as path since the target value can now be reached with fewer projections.
575575
/// If the defining instruction of the value does not match the head of the path as in
576576
/// `%t = tuple ...` and `"s0.t1"` then `unmatchedPath(%t, ...)` is called.

SwiftCompilerSources/Sources/SIL/Value.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ extension Value {
198198
ProjectedValue(value: self, path: path)
199199
}
200200

201-
/// Returns a projected value, defined by this value and path containig a single field of `kind` and `index`.
201+
/// Returns a projected value, defined by this value and path containing a single field of `kind` and `index`.
202202
public func at(_ kind: SmallProjectionPath.FieldKind, index: Int = 0) -> ProjectedValue {
203203
ProjectedValue(value: self, path: SmallProjectionPath(kind, index: index))
204204
}

SwiftCompilerSources/force_lib.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
/// Dummy source file to force CMake generated SwiftInTheCompiler.xcodeproj
14-
/// to successfully build static libraries conatining only object files used
14+
/// to successfully build static libraries containing only object files used
1515
/// during "bootstrap" process to link Swift sources into the compiler.

0 commit comments

Comments
 (0)