Skip to content

Commit 949c2ba

Browse files
committed
Fix some typos in SwiftCompilerSources/Sources
1 parent 6bef9e9 commit 949c2ba

20 files changed

+42
-42
lines changed

SwiftCompilerSources/Sources/AST/SubstitutionMap.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public struct SubstitutionMap: CustomStringConvertible, NoReflectionChildren {
6868
TypeArray(bridged: bridged.getReplacementTypes())
6969
}
7070

71-
/// The single replacement type if it's guarnateed that the substitution map has a single replacement type.
71+
/// The single replacement type if it's guaranteed that the substitution map has a single replacement type.
7272
public var replacementType: Type {
7373
assert(replacementTypes.count == 1)
7474
return replacementTypes[0]

SwiftCompilerSources/Sources/Optimizer/Analysis/AliasAnalysis.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ struct AliasAnalysis {
9797
return false
9898
}
9999
}
100-
// Finaly use escape info to check if one address "escapes" to the other address.
101-
return v1.allContainedAddresss.canAddressAlias(with: v2.allContainedAddresss, context)
100+
// Finally use escape info to check if one address "escapes" to the other address.
101+
return v1.allContainedAddresses.canAddressAlias(with: v2.allContainedAddresses, context)
102102
}
103103

104104
static func register() {
@@ -339,7 +339,7 @@ struct AliasAnalysis {
339339
return .noEffects
340340
}
341341
if destroy.isDeadEnd {
342-
// We don't have to take deinit effects into acount for a `destroy_value [dead_end]`.
342+
// We don't have to take deinit effects into account for a `destroy_value [dead_end]`.
343343
// Such destroys are lowered to no-ops and will not call any deinit.
344344
return .noEffects
345345
}
@@ -471,7 +471,7 @@ struct AliasAnalysis {
471471
}
472472

473473
// To avoid quadratic complexity for large functions, we limit the amount of work that the EscapeUtils are
474-
// allowed to to. This keeps the complexity linear.
474+
// allowed to do. This keeps the complexity linear.
475475
//
476476
// This arbitrary limit is good enough for almost all functions. It lets
477477
// the EscapeUtils do several hundred up/down walks which is much more than needed in most cases.
@@ -481,14 +481,14 @@ struct AliasAnalysis {
481481
for _ in function.instructions { numInsts += 1 }
482482
cache.estimatedFunctionSize = numInsts
483483
}
484-
return 1000000 / cache.estimatedFunctionSize!
484+
return 1_000_000 / cache.estimatedFunctionSize!
485485
}
486486

487487
/// Returns true if the `instruction` (which in general writes to memory) is immutable in a certain scope,
488488
/// defined by `address`.
489489
///
490490
/// That means that even if we don't know anything about `instruction`, we can be sure
491-
/// that `instruction` cannot write to `address`, if it's inside the addresse's scope.
491+
/// that `instruction` cannot write to `address`, if it's inside the address's scope.
492492
/// An immutable scope is for example a read-only `begin_access`/`end_access` scope.
493493
/// Another example is a borrow scope of an immutable copy-on-write buffer.
494494
private func isImmutable(instruction: Instruction, inScopeOf address: Value) -> Bool {
@@ -797,7 +797,7 @@ private struct FullApplyEffectsVisitor : EscapeVisitorWithResult {
797797

798798
// In contrast to a full apply, the effects of a partial_apply don't depend on the callee
799799
// (a partial_apply doesn't call anything, it just creates a thick function pointer).
800-
// The only effects come from capturing the arguments (either consuming or guaranteeed).
800+
// The only effects come from capturing the arguments (either consuming or guaranteed).
801801
private struct PartialApplyEffectsVisitor : EscapeVisitorWithResult {
802802
let partialApply: PartialApplyInst
803803
var result = SideEffects.Memory.noEffects

SwiftCompilerSources/Sources/Optimizer/DataStructures/InstructionRange.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ extension InstructionRange {
240240
}
241241
return .containsEnd
242242
}
243-
// Neither end-point is contained. If a backward path walk encouters this range, then it must overlap this
243+
// Neither end-point is contained. If a backward path walk encounters this range, then it must overlap this
244244
// range. Otherwise, it is disjoint.
245245
var backwardBlocks = BasicBlockWorklist(context)
246246
defer { backwardBlocks.deinitialize() }

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/CopyToBorrowOptimization.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import SIL
3939
/// ```
4040

4141
/// The optimization can be done if:
42-
/// * In caseof a `load`: during the (forward-extended) lifetime of the loaded value the
42+
/// * In case of a `load`: during the (forward-extended) lifetime of the loaded value the
4343
/// memory location is not changed.
4444
/// * In case of a `copy_value`: the (guaranteed) lifetime of the source operand extends
4545
/// the lifetime of the copied value.

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/DeadStoreElimination.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ let deadStoreElimination = FunctionPass(name: "dead-store-elimination") {
7676

7777
private func tryEliminate(store: StoreInst, complexityBudget: inout Int, _ context: FunctionPassContext) {
7878
// Check if the type can be expanded without a significant increase to code
79-
// size. This pass splits values into its consitutent parts which effectively
79+
// size. This pass splits values into its constituent parts which effectively
8080
// expands the value into projections which can increase code size.
8181
if !store.hasValidOwnershipForDeadStoreElimination || !store.source.type.shouldExpand(context) {
8282
return

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceDiagnostics.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ let lifetimeDependenceDiagnosticsPass = FunctionPass(
6666
// For now, if the mark_dependence wasn't recognized as a lifetime dependency, or if the dependencies uses are not
6767
// in scope, conservatively settle it as escaping. For example, it is not uncommon for the pointer value returned
6868
// by `unsafeAddress` to outlive its `self` argument. This will not be diagnosed as an error, but the
69-
// mark_dependence will hanceforth be treated as an unknown use by the optimizer. In the future, we should not
69+
// mark_dependence will henceforth be treated as an unknown use by the optimizer. In the future, we should not
7070
// need to set this flag during diagnostics because, for escapable types, mark_dependence [unresolved] will all be
7171
// settled during an early LifetimeNormalization pass.
7272
markDep.settleToEscaping(context)
@@ -422,8 +422,8 @@ private struct LifetimeVariable {
422422
///
423423
/// This supports store-to-yield. Storing to a yield is an escape unless the yielded memory location depends on another
424424
/// lifetime that already depends on the current scope. When setter depends on 'newValue', 'newValue' is stored to the
425-
/// yielded address, and the yielded addrses depends on the lifetime of 'self'. A mark_dependence should have already
426-
/// been inserted for that lifetime depenence:
425+
/// yielded address, and the yielded addresses depends on the lifetime of 'self'. A mark_dependence should have already
426+
/// been inserted for that lifetime dependence:
427427
///
428428
/// (%a, %t) = begin_apply %f(%self)
429429
/// : $@yield_once @convention(method) (@inout Self) -> _inherit(0) @yields @inout Self.field
@@ -459,7 +459,7 @@ extension DependentAddressUseDefWalker: AddressUseDefWalker {
459459
}
460460
}
461461

462-
/// Walk down lifetime depenence uses. For each check that all dependent
462+
/// Walk down lifetime dependence uses. For each check that all dependent
463463
/// leaf uses are non-escaping and within the dependence scope. The walk
464464
/// starts with add address for .access dependencies. The walk can
465465
/// transition from an address to a value at a load. The walk can

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceInsertion.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ private extension LifetimeDependentApply.LifetimeSourceInfo {
191191
// (a) the result or yield is never returned from this function
192192
//
193193
// (b) the inherited lifetime has a dependence root within this function (it comes from a dependent function
194-
// argument or scoped dependence). In this case, when that depedence root is diagnosed, the analysis will find
195-
// transtive uses of this apply's result.
194+
// argument or scoped dependence). In this case, when that dependence root is diagnosed, the analysis will find
195+
// transitive uses of this apply's result.
196196
//
197197
// (c) the dependent value is passed to another call with a dependent inout argument, or it is stored to a yielded
198198
// address of a coroutine that has a dependent inout argument. In this case, a mark_dependence will already be
@@ -346,7 +346,7 @@ func gatherVariableIntroducers(for value: Value, _ context: Context)
346346
///
347347
/// dependsOn(lvalue.computed) // finds the temporary value directly returned by a getter.
348348
///
349-
/// SILGen emits temporary copies that violate lifetime dependence semantcs. This utility looks through such temporary
349+
/// SILGen emits temporary copies that violate lifetime dependence semantics. This utility looks through such temporary
350350
/// copies, stopping at a value that introduces an immutable variable: move_value [var_decl] or begin_borrow [var_decl],
351351
/// or at an access of a mutable variable: begin_access [read] or begin_access [modify].
352352
///

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceScopeFixup.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ extension ScopeExtension {
666666

667667
log("Scope fixup for dependent uses:\n\(useRange)")
668668

669-
// Lifetime dependenent uses may not be dominated by `innermostScope`. The dependent value may be used by a phi or
669+
// Lifetime dependent uses may not be dominated by `innermostScope`. The dependent value may be used by a phi or
670670
// stored into a memory location. The access may be conditional relative to such uses. If any use was not dominated,
671671
// then `useRange` will include the function entry. There is no way to directly check if `useRange` is
672672
// valid. `useRange.blockRange.isValid` is not a strong enough check because it will always succeed when
@@ -695,12 +695,12 @@ extension ScopeExtension {
695695
var extendedUseRange = InstructionRange(begin: useRange.begin!, ends: useRange.ends, context)
696696

697697
// Insert the first instruction of the exit blocks to mimic `useRange`. There is no way to directly copy
698-
// `useRange`. Inserting the exit block instructions is innacurate, but for the purpose of canExtend() below, it has
698+
// `useRange`. Inserting the exit block instructions is inaccurate, but for the purpose of canExtend() below, it has
699699
// the same effect as a copy of `useRange`.
700700
extendedUseRange.insert(contentsOf: useRange.exits)
701701
defer { extendedUseRange.deinitialize() }
702702

703-
// Append each scope that needs extention to scopesToExtend from the inner to the outer scope.
703+
// Append each scope that needs extension to scopesToExtend from the inner to the outer scope.
704704
for extScope in scopes.reversed() {
705705
// An outer scope might not originally cover one of its inner scopes. Therefore, extend 'extendedUseRange' to to
706706
// cover this scope's end instructions. The extended scope must at least cover the original scopes because the

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ObjCBridgingOptimization.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ private func removeBridgingCodeInPredecessors(of block: BasicBlock, _ context: F
248248
/// ```
249249
/// switch_enum %0 // returned instruction
250250
/// some_bb(%1):
251-
/// %2 = enum #some(%1) // only in case of ObjC -> Swift briding
251+
/// %2 = enum #some(%1) // only in case of ObjC -> Swift bridging
252252
/// %3 = apply %bridging(%2) // returned by `isBridging`
253253
/// %4 = enum #some(%3)
254254
/// br continue_bb(%4)
@@ -338,7 +338,7 @@ func isBridgeToSwiftCall(_ value: Value) -> ApplyInst? {
338338
let funcName = bridgingFunc.name
339339
guard bridgingFunc.hasSemanticsAttribute("bridgeFromObjectiveC") ||
340340
// Currently the semantics attribute is not used, so test for specific functions, too.
341-
// TODO: remove those checks once the briding functions are annotate with "bridgeFromObjectiveC"
341+
// TODO: remove those checks once the bridging functions are annotated with "bridgeFromObjectiveC"
342342
// in Foundation.
343343
//
344344
// String._unconditionallyBridgeFromObjectiveC(_:)

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/StackPromotion.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ private struct ComputeOuterBlockrange : EscapeVisitorWithResult {
286286
result.insert(operandsDefinitionBlock)
287287

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

SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyMarkDependence.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extension MarkDependenceInst : OnoneSimplifiable, SILCombineSimplifiable {
1919
func simplify(_ context: SimplifyContext) {
2020
if isRedundant ||
2121
// A literal lives forever, so no mark_dependence is needed.
22-
// This pattern can occur after StringOptimization when a utf8CString of a literal is replace
22+
// This pattern can occur after StringOptimization when a utf8CString of a literal is replaced
2323
// by the string_literal itself.
2424
value.isLiteral
2525
{

SwiftCompilerSources/Sources/Optimizer/Utilities/BorrowUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ func computeBorrowLiveRange(for value: Value, _ context: FunctionPassContext)
465465
for beginBorrow in value.getBorrowIntroducers(context) {
466466
/// FIXME: Remove calls to computeKnownLiveness() as soon as lifetime completion runs immediately after
467467
/// SILGen. Instead, this should compute linear liveness for borrowed value by switching over BeginBorrowValue, just
468-
/// like LifetimeDependenc.Scope.computeRange().
468+
/// like LifetimeDependence.Scope.computeRange().
469469
ranges.push((beginBorrow, computeKnownLiveness(for: beginBorrow.value, context)))
470470
}
471471
return ranges

SwiftCompilerSources/Sources/Optimizer/Utilities/ForwardingUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ extension ForwardingDefUseWalker {
303303
/// gatherLifetimeIntroducers().
304304
///
305305
/// TODO: make the visitor non-escaping once Swift supports stored
306-
/// non-escaping closues.
306+
/// non-escaping closures.
307307
func visitForwardedUses(introducer: Value, _ context: Context,
308308
visitor: @escaping (ForwardingUseResult) -> WalkResult)
309309
-> WalkResult {

SwiftCompilerSources/Sources/Optimizer/Utilities/GenericSpecialization.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func specializeWitnessTable(for conformance: Conformance,
175175
}
176176

177177
/// Specializes the default methods of a non-generic witness table.
178-
/// Default implementations (in protocol extentions) of non-generic protocol methods have a generic
178+
/// Default implementations (in protocol extensions) of non-generic protocol methods have a generic
179179
/// self argument. Specialize such methods with the concrete type. Note that it is important to also
180180
/// specialize inherited conformances so that the concrete self type is correct, even for derived classes.
181181
private func specializeDefaultMethods(for conformance: Conformance,
@@ -238,7 +238,7 @@ private func specializeDefaultMethods(for conformance: Conformance,
238238

239239
private extension Function {
240240
// True, if this is a non-generic method which might have a generic self argument.
241-
// Default implementations (in protocol extentions) of non-generic protocol methods have a generic
241+
// Default implementations (in protocol extensions) of non-generic protocol methods have a generic
242242
// self argument.
243243
func isNonGenericWitnessMethod(_ context: some Context) -> Bool {
244244
switch loweredFunctionType.invocationGenericSignatureOfFunction.genericParameters.count {

SwiftCompilerSources/Sources/Optimizer/Utilities/LifetimeDependenceUtils.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ extension LifetimeDependence.Scope {
382382
}
383383

384384
extension LifetimeDependence.Scope {
385-
/// Ignore "irrelevent" borrow scopes: load_borrow or begin_borrow without [var_decl]
385+
/// Ignore "irrelevant" borrow scopes: load_borrow or begin_borrow without [var_decl]
386386
func ignoreBorrowScope(_ context: some Context) -> LifetimeDependence.Scope? {
387387
guard case let .borrowed(beginBorrowVal) = self else {
388388
return nil
@@ -560,7 +560,7 @@ protocol LifetimeDependenceDefUseWalker : ForwardingDefUseWalker,
560560
}
561561

562562
extension LifetimeDependenceDefUseWalker {
563-
// Use a distict context name to avoid rdar://123424566 (Unable to open existential)
563+
// Use a distinct context name to avoid rdar://123424566 (Unable to open existential)
564564
var walkerContext: Context { context }
565565
}
566566

@@ -824,7 +824,7 @@ extension LifetimeDependenceDefUseWalker {
824824

825825
// Helpers
826826
extension LifetimeDependenceDefUseWalker {
827-
// Visit uses of borrowing instruction (operandOwnerhip == .borrow).
827+
// Visit uses of borrowing instruction (operandOwnership == .borrow).
828828
private mutating func visitAllBorrowUses(
829829
of operand: Operand, by borrowInst: BorrowingInstruction) -> WalkResult {
830830
switch borrowInst {
@@ -855,7 +855,7 @@ extension LifetimeDependenceDefUseWalker {
855855
}
856856
}
857857

858-
// Visit a dependent local variable (alloc_box), or temporary storage (alloc_stack). The depenedency is typically from
858+
// Visit a dependent local variable (alloc_box), or temporary storage (alloc_stack). The dependency is typically from
859859
// storing a dependent value at `address`, but may be from an outright `mark_dependence_addr`.
860860
//
861861
// This handles stores of the entire value and stores into a member. Storing into a member makes the entire aggregate
@@ -1110,7 +1110,7 @@ private struct LifetimeDependenceUsePrinter : LifetimeDependenceDefUseWalker {
11101110
///
11111111
/// dependsOn(lvalue.computed) // finds the temporary value directly returned by a getter.
11121112
///
1113-
/// SILGen emits temporary copies that violate lifetime dependence semantcs. This utility looks through such temporary
1113+
/// SILGen emits temporary copies that violate lifetime dependence semantics. This utility looks through such temporary
11141114
/// copies, stopping at a value that introduces an immutable variable: move_value [var_decl] or begin_borrow [var_decl],
11151115
/// or at an access of a mutable variable: begin_access [read] or begin_access [modify].
11161116
///
@@ -1238,7 +1238,7 @@ extension LifetimeDependenceUseDefAddressWalker {
12381238
if let addressorSelf = beginAccess.unsafeAddressorSelf {
12391239
return walkUp(newLifetime: addressorSelf)
12401240
}
1241-
// Ignore the acces scope for trivial values regardless of whether it is singly-initialized. Trivial values do not
1241+
// Ignore the access scope for trivial values regardless of whether it is singly-initialized. Trivial values do not
12421242
// need to be kept alive in memory and can be safely be overwritten in the same scope. Lifetime dependence only
12431243
// cares that the loaded value is within the lexical scope of the trivial value's variable declaration. Rather
12441244
// than skipping all access scopes, call 'walkUp' on each nested access in case one of them needs to redirect the

SwiftCompilerSources/Sources/Optimizer/Utilities/LocalVariableUtils.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
///
1313
/// SIL operates on three kinds of addressable memory:
1414
///
15-
/// 1. Temporary RValues. These are recognied by AddressInitializationWalker. These largely disappear with opaque SIL
15+
/// 1. Temporary RValues. These are recognized by AddressInitializationWalker. These largely disappear with opaque SIL
1616
/// values.
1717
///
1818
/// 2. Local variables. These are always introduced by either a VarDeclInstruction or a Function argument with non-nil
@@ -774,7 +774,7 @@ extension LocalVariableReachableAccess {
774774

775775
/// This performs a forward CFG walk to find all uses of this local variable reachable after `begin`.
776776
///
777-
/// If `lifetime` is true, then this gathers the full known lifetime, includeing destroys and reassignments ignoring
777+
/// If `lifetime` is true, then this gathers the full known lifetime, including destroys and reassignments ignoring
778778
/// escapes.
779779
///
780780
/// If `lifetime` is false, then this returns `false` if the walk ended early because of a reachable escape.

SwiftCompilerSources/Sources/Optimizer/Utilities/OwnershipLiveness.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func computeKnownLiveness(for definingValue: Value, visitInnerUses: Bool = false
8484
visitInnerUses: visitInnerUses, context).acquireRange
8585
}
8686

87-
/// If any interior pointer may escape, then record the first instance here. If 'ignoseEscape' is true, this
87+
/// If any interior pointer may escape, then record the first instance here. If 'ignoreEscape' is true, this
8888
/// immediately aborts the walk, so further instances are unavailable.
8989
///
9090
/// .escaping may either be a non-address operand with

SwiftCompilerSources/Sources/SIL/Function.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ final public class Function : CustomStringConvertible, HasShortDescription, Hash
189189

190190
// If Package-CMO is enabled, we serialize package, public, and @usableFromInline decls as
191191
// [serialized_for_package].
192-
// Their bodies must not, however, leak into @inlinable functons (that are [serialized])
192+
// Their bodies must not, however, leak into @inlinable functions (that are [serialized])
193193
// since they are inlined outside of their defining module.
194194
//
195195
// If this callee is [serialized_for_package], the caller must be either non-serialized

0 commit comments

Comments
 (0)