Skip to content

[pmo] Debride more code that is still in PMO but was only used by DI. #21641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
29 changes: 0 additions & 29 deletions lib/SILOptimizer/Mandatory/PMOMemoryUseCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,35 +135,6 @@ PMOMemoryObjectInfo::getPathStringToElement(unsigned Element,
return nullptr;
}

/// If the specified value is a 'let' property in an initializer, return true.
bool PMOMemoryObjectInfo::isElementLetProperty(unsigned Element) const {
// If we aren't representing 'self' in a non-delegating initializer, then we
// can't have 'let' properties.
return IsLet;
}

//===----------------------------------------------------------------------===//
// PMOMemoryUse Implementation
//===----------------------------------------------------------------------===//

/// onlyTouchesTrivialElements - Return true if all of the accessed elements
/// have trivial type.
bool PMOMemoryUse::onlyTouchesTrivialElements(
const PMOMemoryObjectInfo &MI) const {
auto &Module = Inst->getModule();

for (unsigned i = FirstElement, e = i + NumElements; i != e; ++i) {
// Skip 'super.init' bit
if (i == MI.getNumMemoryElements())
return false;

auto EltTy = MI.getElementType(i);
if (!EltTy.isTrivial(Module))
return false;
}
return true;
}

//===----------------------------------------------------------------------===//
// Scalarization Logic
//===----------------------------------------------------------------------===//
Expand Down
17 changes: 1 addition & 16 deletions lib/SILOptimizer/Mandatory/PMOMemoryUseCollector.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ class PMOMemoryObjectInfo {
/// This is the base type of the memory allocation.
SILType MemorySILType;

/// True if the memory object being analyzed represents a 'let', which is
/// initialize-only (reassignments are not allowed).
bool IsLet = false;

/// This is the count of elements being analyzed. For memory objects that are
/// tuples, this is the flattened element count. For 'self' members in init
/// methods, this is the local field count (+1 for derive classes).
Expand Down Expand Up @@ -108,11 +104,7 @@ class PMOMemoryObjectInfo {
return dyn_cast<AllocBoxInst>(MemoryInst);
}

/// getNumMemoryElements - Return the number of elements, without the extra
/// "super.init" tracker in initializers of derived classes.
unsigned getNumMemoryElements() const {
return NumElements - unsigned(false);
}
unsigned getNumMemoryElements() const { return NumElements; }

/// getElementType - Return the swift type of the specified element.
SILType getElementType(unsigned EltNo) const;
Expand All @@ -122,9 +114,6 @@ class PMOMemoryObjectInfo {
/// be determined, return it. Otherwise, return null.
ValueDecl *getPathStringToElement(unsigned Element,
std::string &Result) const;

/// If the specified value is a 'let' property in an initializer, return true.
bool isElementLetProperty(unsigned Element) const;
};

enum PMOUseKind {
Expand Down Expand Up @@ -186,10 +175,6 @@ struct PMOMemoryUse {
i < static_cast<unsigned>(FirstElement + NumElements);
}

/// onlyTouchesTrivialElements - Return true if all of the accessed elements
/// have trivial type.
bool onlyTouchesTrivialElements(const PMOMemoryObjectInfo &MemoryInfo) const;

/// getElementBitmask - Return a bitmask with the touched tuple elements
/// set.
APInt getElementBitmask(unsigned NumMemoryTupleElements) const {
Expand Down