Skip to content

Commit a40a7be

Browse files
authored
Merge pull request #82090 from valeriyvan/typos
Fix some typos in SwiftCompilerSources/Sources
2 parents 53c4566 + 761bee9 commit a40a7be

23 files changed

+53
-53
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: 8 additions & 8 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() {
@@ -148,7 +148,7 @@ struct AliasAnalysis {
148148
bridgedObj: BridgedValue) -> Bool in
149149
let context = FunctionPassContext(_bridged: bridgedCtxt)
150150
let aa = AliasAnalysis(bridged: bridgedAliasAnalysis, context: context)
151-
let addr = bridgedAddr.value.allContainedAddresss
151+
let addr = bridgedAddr.value.allContainedAddresses
152152

153153
// This is similar to `canReferenceSameFieldFn`, except that all addresses of all objects are
154154
// considered which are transitively visible from `bridgedObj`.
@@ -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: 5 additions & 5 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
@@ -219,8 +219,8 @@ private extension LifetimeDependentApply.LifetimeSourceInfo {
219219
return
220220
}
221221
// Create a new dependence on the apply's access to the argument.
222-
for varIntoducer in gatherVariableIntroducers(for: source.value, context) {
223-
let scope = LifetimeDependence.Scope(base: varIntoducer, context)
222+
for varIntroducer in gatherVariableIntroducers(for: source.value, context) {
223+
let scope = LifetimeDependence.Scope(base: varIntroducer, context)
224224
log("Scoped lifetime from \(source.value)")
225225
log(" scope: \(scope)")
226226
bases.append(scope.parentValue)
@@ -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/SimplifyApply.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private func tryReplaceExistentialArchetype(of apply: ApplyInst, _ context: Simp
177177

178178
let newApply = builder.createApply(
179179
function: apply.callee,
180-
apply.replaceOpenedArchetypeInSubstituations(withConcreteType: concreteType, context),
180+
apply.replaceOpenedArchetypeInSubstitutions(withConcreteType: concreteType, context),
181181
arguments: apply.replaceExistentialArchetypeInArguments(withConcreteType: concreteType, context),
182182
isNonThrowing: apply.isNonThrowing, isNonAsync: apply.isNonAsync,
183183
specializationInfo: apply.specializationInfo)
@@ -197,7 +197,7 @@ private func tryReplaceExistentialArchetype(of tryApply: TryApplyInst, _ context
197197

198198
builder.createTryApply(
199199
function: tryApply.callee,
200-
tryApply.replaceOpenedArchetypeInSubstituations(withConcreteType: concreteType, context),
200+
tryApply.replaceOpenedArchetypeInSubstitutions(withConcreteType: concreteType, context),
201201
arguments: tryApply.replaceExistentialArchetypeInArguments(withConcreteType: concreteType, context),
202202
normalBlock: tryApply.normalBlock, errorBlock: tryApply.errorBlock,
203203
isNonAsync: tryApply.isNonAsync,
@@ -269,7 +269,7 @@ private extension FullApplySite {
269269
return Array(newArgs)
270270
}
271271

272-
func replaceOpenedArchetypeInSubstituations(
272+
func replaceOpenedArchetypeInSubstitutions(
273273
withConcreteType concreteType: CanonicalType,
274274
_ context: SimplifyContext
275275
) -> SubstitutionMap {

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/TestPasses/EscapeInfoDumper.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ let addressEscapeInfoDumper = FunctionPass(name: "dump-addr-escape-info") {
109109
for value in valuesToCheck {
110110
print("value:\(value)")
111111
for apply in applies {
112-
if value.allContainedAddresss.isEscaping(using: Visitor(apply: apply), context) {
112+
if value.allContainedAddresses.isEscaping(using: Visitor(apply: apply), context) {
113113
print(" ==> \(apply)")
114114
} else {
115115
print(" - \(apply)")
@@ -127,8 +127,8 @@ let addressEscapeInfoDumper = FunctionPass(name: "dump-addr-escape-info") {
127127
print(lhs)
128128
print(rhs)
129129

130-
let projLhs = lhs.allContainedAddresss
131-
let projRhs = rhs.allContainedAddresss
130+
let projLhs = lhs.allContainedAddresses
131+
let projRhs = rhs.allContainedAddresses
132132
let mayAlias = projLhs.canAddressAlias(with: projRhs, context)
133133
if mayAlias != projRhs.canAddressAlias(with: projLhs, context) {
134134
fatalError("canAddressAlias(with:) must be symmetric")

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 {

0 commit comments

Comments
 (0)