[lld] c2f7745 - [lld-macho] Remove redundant hasValidData. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 5 15:59:23 PST 2025
Author: Fangrui Song
Date: 2025-01-05T15:59:17-08:00
New Revision: c2f7745b4ef7a79ca0789efee997e973ed896380
URL: https://github.com/llvm/llvm-project/commit/c2f7745b4ef7a79ca0789efee997e973ed896380
DIFF: https://github.com/llvm/llvm-project/commit/c2f7745b4ef7a79ca0789efee997e973ed896380.diff
LOG: [lld-macho] Remove redundant hasValidData. NFC
lld::macho::runBalancedPartitioning ensures that all sections satisfy
`hasValidData`.
Added:
Modified:
lld/Common/BPSectionOrdererBase.cpp
lld/MachO/BPSectionOrderer.h
lld/include/lld/Common/BPSectionOrdererBase.h
Removed:
################################################################################
diff --git a/lld/Common/BPSectionOrdererBase.cpp b/lld/Common/BPSectionOrdererBase.cpp
index 7c5874f0d04131..75be4f6aa9bc09 100644
--- a/lld/Common/BPSectionOrdererBase.cpp
+++ b/lld/Common/BPSectionOrdererBase.cpp
@@ -109,9 +109,6 @@ BPSectionBase::reorderSectionsByBalancedPartitioning(
// Process input sections
for (const auto &isec : inputSections) {
- if (!isec->hasValidData())
- continue;
-
unsigned sectionIdx = sections.size();
sectionToIdx.try_emplace(isec->getSection(), sectionIdx);
sections.emplace_back(isec.get());
@@ -371,4 +368,4 @@ BPSectionBase::reorderSectionsByBalancedPartitioning(
for (const auto *isec : orderedSections)
sectionPriorities[isec] = --highestAvailablePriority;
return sectionPriorities;
-}
\ No newline at end of file
+}
diff --git a/lld/MachO/BPSectionOrderer.h b/lld/MachO/BPSectionOrderer.h
index 29b20c781c6b0d..8ba911fcc546bd 100644
--- a/lld/MachO/BPSectionOrderer.h
+++ b/lld/MachO/BPSectionOrderer.h
@@ -68,10 +68,6 @@ class BPSectionMacho : public BPSectionBase {
bool isCodeSection() const override { return macho::isCodeSection(isec); }
- bool hasValidData() const override {
- return isec && !isec->data.empty() && isec->data.data();
- }
-
SmallVector<std::unique_ptr<BPSymbol>> getSymbols() const override {
SmallVector<std::unique_ptr<BPSymbol>> symbols;
for (auto *sym : isec->symbols)
diff --git a/lld/include/lld/Common/BPSectionOrdererBase.h b/lld/include/lld/Common/BPSectionOrdererBase.h
index 6f483aff464aa8..e2cb41f69cc684 100644
--- a/lld/include/lld/Common/BPSectionOrdererBase.h
+++ b/lld/include/lld/Common/BPSectionOrdererBase.h
@@ -37,7 +37,6 @@ class BPSectionBase {
public:
virtual ~BPSectionBase() = default;
virtual uint64_t getSize() const = 0;
- virtual bool hasValidData() const = 0;
virtual bool isCodeSection() const = 0;
virtual llvm::SmallVector<std::unique_ptr<BPSymbol>> getSymbols() const = 0;
virtual const void *getSection() const = 0;
More information about the llvm-commits
mailing list