Skip to content

Commit d1637af

Browse files
Merge pull request swiftlang#83789 from nate-chandler/nfc/20250818/1
[NFC] Renamed three SIL utilities.
2 parents 7642d41 + 5da38cb commit d1637af

40 files changed

+475
-480
lines changed

docs/SIL/Instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ extend_lifetime %0 : $X
10321032
```
10331033

10341034
Indicates that a value's linear lifetime extends to this point.
1035-
Inserted by OSSALifetimeCompletion(AvailabilityBoundary) in order to
1035+
Inserted by OSSACompleteLifetime(AvailabilityBoundary) in order to
10361036
provide the invariant that a value is either consumed OR has an
10371037
`extend_lifetime` user on all paths and furthermore that all
10381038
uses are within the boundary defined by that set of instructions (the

include/swift/SIL/OSSALifetimeCompletion.h renamed to include/swift/SIL/OSSACompleteLifetime.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class DeadEndBlocks;
3838

3939
enum class LifetimeCompletion { NoLifetime, AlreadyComplete, WasCompleted };
4040

41-
class OSSALifetimeCompletion {
41+
class OSSACompleteLifetime {
4242
public:
4343
enum HandleTrivialVariable_t { IgnoreTrivialVariable, ExtendTrivialVariable };
4444

@@ -63,7 +63,7 @@ class OSSALifetimeCompletion {
6363
bool ForceLivenessVerification;
6464

6565
public:
66-
OSSALifetimeCompletion(
66+
OSSACompleteLifetime(
6767
SILFunction *function, const DominanceInfo *domInfo,
6868
DeadEndBlocks &deadEndBlocks,
6969
HandleTrivialVariable_t handleTrivialVariable = IgnoreTrivialVariable,
@@ -113,8 +113,8 @@ class OSSALifetimeCompletion {
113113
break;
114114
}
115115
// During SILGenCleanup, extend move_value [var_decl].
116-
if (handleTrivialVariable == ExtendTrivialVariable
117-
&& value->isFromVarDecl()) {
116+
if (handleTrivialVariable == ExtendTrivialVariable &&
117+
value->isFromVarDecl()) {
118118
break;
119119
}
120120
return LifetimeCompletion::NoLifetime;
@@ -203,13 +203,13 @@ class UnreachableLifetimeCompletion {
203203
bool completeLifetimes();
204204
};
205205

206-
inline llvm::raw_ostream &
207-
operator<<(llvm::raw_ostream &OS, OSSALifetimeCompletion::Boundary boundary) {
206+
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
207+
OSSACompleteLifetime::Boundary boundary) {
208208
switch (boundary) {
209-
case OSSALifetimeCompletion::Boundary::Liveness:
209+
case OSSACompleteLifetime::Boundary::Liveness:
210210
OS << "liveness";
211211
break;
212-
case OSSALifetimeCompletion::Boundary::Availability:
212+
case OSSACompleteLifetime::Boundary::Availability:
213213
OS << "availability";
214214
break;
215215
}

include/swift/SILOptimizer/Utils/CanonicalizeBorrowScope.h renamed to include/swift/SILOptimizer/Utils/OSSACanonicalizeGuaranteed.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- CanonicalizeBorrowScope.h - Canonicalize OSSA borrows --*- C++ -*-===//
1+
//===- OSSACanonicalizeGuaranteed.h - Canonicalize OSSA borrows -*- C++ -*-===//
22
//
33
// This source file is part of the Swift.org open source project
44
//
@@ -14,7 +14,7 @@
1414
/// to only the uses within the scope. To do this, it hoists forwarding
1515
/// operations out of the scope. This exposes many useless scopes that can be
1616
/// deleted, which in turn allows canonicalization of the outer owned values
17-
/// (via CanonicalizeOSSALifetime).
17+
/// (via OSSACanonicalizeOwned).
1818
///
1919
/// This does not shrink borrow scopes; it does not rewrite end_borrows. For
2020
/// that, see ShrinkBorrowScope.
@@ -40,10 +40,10 @@ namespace swift {
4040
class BasicCalleeAnalysis;
4141

4242
//===----------------------------------------------------------------------===//
43-
// MARK: CanonicalizeBorrowScope
43+
// MARK: OSSACanonicalizeGuaranteed
4444
//===----------------------------------------------------------------------===//
4545

46-
class CanonicalizeBorrowScope {
46+
class OSSACanonicalizeGuaranteed {
4747
public:
4848
/// Return true if \p inst is an instructions that forwards ownership is its
4949
/// first operand and can be trivially duplicated, sunk to its uses, hoisted
@@ -88,7 +88,7 @@ class CanonicalizeBorrowScope {
8888
llvm::SmallDenseMap<SILBasicBlock *, CopyValueInst *, 4> persistentCopies;
8989

9090
public:
91-
CanonicalizeBorrowScope(SILFunction *function, InstructionDeleter &deleter)
91+
OSSACanonicalizeGuaranteed(SILFunction *function, InstructionDeleter &deleter)
9292
: function(function), deleter(deleter) {}
9393

9494
BorrowedValue getBorrowedValue() const { return borrowedValue; }

include/swift/SILOptimizer/Utils/CanonicalizeOSSALifetime.h renamed to include/swift/SILOptimizer/Utils/OSSACanonicalizeOwned.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- CanonicalizeOSSALifetime.h - Canonicalize OSSA lifetimes -*- C++ -*-===//
1+
//===- OSSACanonicalizeOwned.h - Canonicalize OSSA lifetimes -*- C++ -*-===//
22
//
33
// This source file is part of the Swift.org open source project
44
//
@@ -14,7 +14,7 @@
1414
///
1515
/// This top-level API rewrites the extended OSSA lifetime of a SILValue:
1616
///
17-
/// void canonicalizeValueLifetime(SILValue def, CanonicalizeOSSALifetime &)
17+
/// void canonicalizeValueLifetime(SILValue def, OSSACanonicalizeOwned &)
1818
///
1919
/// The "extended lifetime" of the references defined by 'def' transitively
2020
/// includes the uses of 'def' itself along with the uses of any copies of
@@ -197,7 +197,7 @@ enum MaximizeLifetime_t : bool {
197197
///
198198
/// TODO: Move all the private per-definition members into an implementation
199199
/// class in the .cpp file.
200-
class CanonicalizeOSSALifetime final {
200+
class OSSACanonicalizeOwned final {
201201
public:
202202
/// Find the original definition of a potentially copied value. \p copiedValue
203203
/// must be an owned value. It is usually a copy but may also be a destroy.
@@ -210,7 +210,7 @@ class CanonicalizeOSSALifetime final {
210210
/// If the source of a copy is guaranteed, then the copy itself is the root of
211211
/// an owned extended lifetime. Note that it will also be part of a borrowed
212212
/// extended lifetime, which will be canonicalized separately by
213-
/// CanonicalizeBorrowScope.
213+
/// OSSACanonicalizeGuaranteed.
214214
///
215215
/// This use-def walk must be consistent with the def-use walks performed
216216
/// within the canonicalizeValueLifetime() and canonicalizeBorrowScopes()
@@ -343,14 +343,14 @@ class CanonicalizeOSSALifetime final {
343343
struct LivenessState {
344344
BitfieldRef<SSAPrunedLiveness>::StackState state;
345345

346-
LivenessState(CanonicalizeOSSALifetime &parent, SILValue def,
346+
LivenessState(OSSACanonicalizeOwned &parent, SILValue def,
347347
ArrayRef<SILInstruction *> lexicalLifetimeEnds)
348348
: state(parent.liveness, def->getFunction()) {
349349
parent.initializeLiveness(def, lexicalLifetimeEnds);
350350
}
351351
};
352352

353-
CanonicalizeOSSALifetime(
353+
OSSACanonicalizeOwned(
354354
PruneDebugInsts_t pruneDebugMode, MaximizeLifetime_t maximizeLifetime,
355355
SILFunction *function, NonLocalAccessBlockAnalysis *accessBlockAnalysis,
356356
DeadEndBlocksAnalysis *deadEndBlocksAnalysis, DominanceInfo *domTree,
@@ -470,7 +470,7 @@ class CanonicalizeOSSALifetime final {
470470
}
471471

472472
bool respectsDeadEnds() const {
473-
// TODO: OSSALifetimeCompletion: Once lifetimes are always complete, delete
473+
// TODO: OSSACompleteLifetime: Once lifetimes are always complete, delete
474474
// this method.
475475
return !endingLifetimeAtExplicitEnds();
476476
}

include/swift/SILOptimizer/Utils/OwnershipOptUtils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ inline bool requiresOSSACleanup(SILValue v) {
4848
///
4949
/// Precondition: lifetimeBoundary is a superset of ownedValue's current
5050
/// lifetime (therefore, none of the safety checks done during
51-
/// CanonicalizeOSSALifetime are needed here).
51+
/// OSSACanonicalizeOwned are needed here).
5252
void extendOwnedLifetime(SILValue ownedValue,
5353
PrunedLivenessBoundary &lifetimeBoundary,
5454
InstructionDeleter &deleter);
@@ -61,7 +61,7 @@ void extendOwnedLifetime(SILValue ownedValue,
6161
///
6262
/// Precondition: guaranteedBoundary is a superset of beginBorrow's current
6363
/// scope (therefore, none of the safety checks done during
64-
/// CanonicalizeBorrowScope are needed here).
64+
/// OSSACanonicalizeGuaranteed are needed here).
6565
void extendLocalBorrow(BeginBorrowInst *beginBorrow,
6666
PrunedLivenessBoundary &guaranteedBoundary,
6767
InstructionDeleter &deleter);

lib/SIL/Utils/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ target_sources(swiftSIL PRIVATE
1313
MemAccessUtils.cpp
1414
MemoryLocations.cpp
1515
OptimizationRemark.cpp
16-
OSSALifetimeCompletion.cpp
16+
OSSACompleteLifetime.cpp
1717
OwnershipLiveness.cpp
1818
OwnershipUtils.cpp
1919
PrettyStackTrace.cpp

0 commit comments

Comments
 (0)