Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/SIL/Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ extend_lifetime %0 : $X
```

Indicates that a value's linear lifetime extends to this point.
Inserted by OSSALifetimeCompletion(AvailabilityBoundary) in order to
Inserted by OSSACompleteLifetime(AvailabilityBoundary) in order to
provide the invariant that a value is either consumed OR has an
`extend_lifetime` user on all paths and furthermore that all
uses are within the boundary defined by that set of instructions (the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DeadEndBlocks;

enum class LifetimeCompletion { NoLifetime, AlreadyComplete, WasCompleted };

class OSSALifetimeCompletion {
class OSSACompleteLifetime {
public:
enum HandleTrivialVariable_t { IgnoreTrivialVariable, ExtendTrivialVariable };

Expand All @@ -63,7 +63,7 @@ class OSSALifetimeCompletion {
bool ForceLivenessVerification;

public:
OSSALifetimeCompletion(
OSSACompleteLifetime(
SILFunction *function, const DominanceInfo *domInfo,
DeadEndBlocks &deadEndBlocks,
HandleTrivialVariable_t handleTrivialVariable = IgnoreTrivialVariable,
Expand Down Expand Up @@ -113,8 +113,8 @@ class OSSALifetimeCompletion {
break;
}
// During SILGenCleanup, extend move_value [var_decl].
if (handleTrivialVariable == ExtendTrivialVariable
&& value->isFromVarDecl()) {
if (handleTrivialVariable == ExtendTrivialVariable &&
value->isFromVarDecl()) {
break;
}
return LifetimeCompletion::NoLifetime;
Expand Down Expand Up @@ -203,13 +203,13 @@ class UnreachableLifetimeCompletion {
bool completeLifetimes();
};

inline llvm::raw_ostream &
operator<<(llvm::raw_ostream &OS, OSSALifetimeCompletion::Boundary boundary) {
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
OSSACompleteLifetime::Boundary boundary) {
switch (boundary) {
case OSSALifetimeCompletion::Boundary::Liveness:
case OSSACompleteLifetime::Boundary::Liveness:
OS << "liveness";
break;
case OSSALifetimeCompletion::Boundary::Availability:
case OSSACompleteLifetime::Boundary::Availability:
OS << "availability";
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===--- CanonicalizeBorrowScope.h - Canonicalize OSSA borrows --*- C++ -*-===//
//===- OSSACanonicalizeGuaranteed.h - Canonicalize OSSA borrows -*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
Expand All @@ -14,7 +14,7 @@
/// to only the uses within the scope. To do this, it hoists forwarding
/// operations out of the scope. This exposes many useless scopes that can be
/// deleted, which in turn allows canonicalization of the outer owned values
/// (via CanonicalizeOSSALifetime).
/// (via OSSACanonicalizeOwned).
///
/// This does not shrink borrow scopes; it does not rewrite end_borrows. For
/// that, see ShrinkBorrowScope.
Expand All @@ -40,10 +40,10 @@ namespace swift {
class BasicCalleeAnalysis;

//===----------------------------------------------------------------------===//
// MARK: CanonicalizeBorrowScope
// MARK: OSSACanonicalizeGuaranteed
//===----------------------------------------------------------------------===//

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

public:
CanonicalizeBorrowScope(SILFunction *function, InstructionDeleter &deleter)
OSSACanonicalizeGuaranteed(SILFunction *function, InstructionDeleter &deleter)
: function(function), deleter(deleter) {}

BorrowedValue getBorrowedValue() const { return borrowedValue; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===- CanonicalizeOSSALifetime.h - Canonicalize OSSA lifetimes -*- C++ -*-===//
//===- OSSACanonicalizeOwned.h - Canonicalize OSSA lifetimes -*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
Expand All @@ -14,7 +14,7 @@
///
/// This top-level API rewrites the extended OSSA lifetime of a SILValue:
///
/// void canonicalizeValueLifetime(SILValue def, CanonicalizeOSSALifetime &)
/// void canonicalizeValueLifetime(SILValue def, OSSACanonicalizeOwned &)
///
/// The "extended lifetime" of the references defined by 'def' transitively
/// includes the uses of 'def' itself along with the uses of any copies of
Expand Down Expand Up @@ -197,7 +197,7 @@ enum MaximizeLifetime_t : bool {
///
/// TODO: Move all the private per-definition members into an implementation
/// class in the .cpp file.
class CanonicalizeOSSALifetime final {
class OSSACanonicalizeOwned final {
public:
/// Find the original definition of a potentially copied value. \p copiedValue
/// must be an owned value. It is usually a copy but may also be a destroy.
Expand All @@ -210,7 +210,7 @@ class CanonicalizeOSSALifetime final {
/// If the source of a copy is guaranteed, then the copy itself is the root of
/// an owned extended lifetime. Note that it will also be part of a borrowed
/// extended lifetime, which will be canonicalized separately by
/// CanonicalizeBorrowScope.
/// OSSACanonicalizeGuaranteed.
///
/// This use-def walk must be consistent with the def-use walks performed
/// within the canonicalizeValueLifetime() and canonicalizeBorrowScopes()
Expand Down Expand Up @@ -343,14 +343,14 @@ class CanonicalizeOSSALifetime final {
struct LivenessState {
BitfieldRef<SSAPrunedLiveness>::StackState state;

LivenessState(CanonicalizeOSSALifetime &parent, SILValue def,
LivenessState(OSSACanonicalizeOwned &parent, SILValue def,
ArrayRef<SILInstruction *> lexicalLifetimeEnds)
: state(parent.liveness, def->getFunction()) {
parent.initializeLiveness(def, lexicalLifetimeEnds);
}
};

CanonicalizeOSSALifetime(
OSSACanonicalizeOwned(
PruneDebugInsts_t pruneDebugMode, MaximizeLifetime_t maximizeLifetime,
SILFunction *function, NonLocalAccessBlockAnalysis *accessBlockAnalysis,
DeadEndBlocksAnalysis *deadEndBlocksAnalysis, DominanceInfo *domTree,
Expand Down Expand Up @@ -470,7 +470,7 @@ class CanonicalizeOSSALifetime final {
}

bool respectsDeadEnds() const {
// TODO: OSSALifetimeCompletion: Once lifetimes are always complete, delete
// TODO: OSSACompleteLifetime: Once lifetimes are always complete, delete
// this method.
return !endingLifetimeAtExplicitEnds();
}
Expand Down
4 changes: 2 additions & 2 deletions include/swift/SILOptimizer/Utils/OwnershipOptUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ inline bool requiresOSSACleanup(SILValue v) {
///
/// Precondition: lifetimeBoundary is a superset of ownedValue's current
/// lifetime (therefore, none of the safety checks done during
/// CanonicalizeOSSALifetime are needed here).
/// OSSACanonicalizeOwned are needed here).
void extendOwnedLifetime(SILValue ownedValue,
PrunedLivenessBoundary &lifetimeBoundary,
InstructionDeleter &deleter);
Expand All @@ -61,7 +61,7 @@ void extendOwnedLifetime(SILValue ownedValue,
///
/// Precondition: guaranteedBoundary is a superset of beginBorrow's current
/// scope (therefore, none of the safety checks done during
/// CanonicalizeBorrowScope are needed here).
/// OSSACanonicalizeGuaranteed are needed here).
void extendLocalBorrow(BeginBorrowInst *beginBorrow,
PrunedLivenessBoundary &guaranteedBoundary,
InstructionDeleter &deleter);
Expand Down
2 changes: 1 addition & 1 deletion lib/SIL/Utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ target_sources(swiftSIL PRIVATE
MemAccessUtils.cpp
MemoryLocations.cpp
OptimizationRemark.cpp
OSSALifetimeCompletion.cpp
OSSACompleteLifetime.cpp
OwnershipLiveness.cpp
OwnershipUtils.cpp
PrettyStackTrace.cpp
Expand Down
Loading