2222#include " lld/Common/ErrorHandler.h"
2323#include " llvm/ADT/CachedHashString.h"
2424#include " llvm/ADT/DenseMap.h"
25- #include " llvm/ADT/DenseSet .h"
25+ #include " llvm/ADT/MapVector .h"
2626#include " llvm/ADT/SetVector.h"
2727#include " llvm/ADT/SmallSet.h"
2828#include " llvm/ADT/SmallVector.h"
3535#include " llvm/Support/VirtualFileSystem.h"
3636#include < memory>
3737#include < optional>
38+ #include < set>
3839
3940#define DEBUG_TYPE " bp-section-orderer"
4041
@@ -60,7 +61,7 @@ template <class D> struct BPOrderer {
6061 bool forDataCompression,
6162 bool compressionSortStartupFunctions, bool verbose,
6263 llvm::ArrayRef<Section *> sections,
63- const DenseMap<CachedHashStringRef, DenseSet <unsigned >>
64+ const DenseMap<CachedHashStringRef, std::set <unsigned >>
6465 &rootSymbolToSectionIdxs)
6566 -> llvm::DenseMap<const Section *, int>;
6667};
@@ -73,7 +74,7 @@ static SmallVector<std::pair<unsigned, UtilityNodes>> getUnsForCompression(
7374 ArrayRef<const typename D::Section *> sections,
7475 const DenseMap<const void *, uint64_t > §ionToIdx,
7576 ArrayRef<unsigned > sectionIdxs,
76- DenseMap<unsigned , SmallVector<unsigned >> *duplicateSectionIdxs,
77+ DenseMap<unsigned , SmallVector<unsigned , 0 >> *duplicateSectionIdxs,
7778 BPFunctionNode::UtilityNodeT &maxUN) {
7879 TimeTraceScope timeScope (" Build nodes for compression" );
7980
@@ -88,7 +89,7 @@ static SmallVector<std::pair<unsigned, UtilityNodes>> getUnsForCompression(
8889 hashes.clear ();
8990 }
9091
91- DenseMap <uint64_t , unsigned > hashFrequency;
92+ MapVector <uint64_t , unsigned > hashFrequency;
9293 for (auto &[sectionIdx, hashes] : sectionHashes)
9394 for (auto hash : hashes)
9495 ++hashFrequency[hash];
@@ -156,7 +157,7 @@ auto BPOrderer<D>::computeOrder(
156157 StringRef profilePath, bool forFunctionCompression, bool forDataCompression,
157158 bool compressionSortStartupFunctions, bool verbose,
158159 ArrayRef<Section *> sections,
159- const DenseMap<CachedHashStringRef, DenseSet <unsigned >>
160+ const DenseMap<CachedHashStringRef, std::set <unsigned >>
160161 &rootSymbolToSectionIdxs) -> DenseMap<const Section *, int > {
161162 TimeTraceScope timeScope (" Setup Balanced Partitioning" );
162163 DenseMap<const void *, uint64_t > sectionToIdx;
@@ -257,7 +258,7 @@ auto BPOrderer<D>::computeOrder(
257258
258259 // Map a section index (order directly) to a list of duplicate section indices
259260 // (not ordered directly).
260- DenseMap<unsigned , SmallVector<unsigned >> duplicateSectionIdxs;
261+ DenseMap<unsigned , SmallVector<unsigned , 0 >> duplicateSectionIdxs;
261262 auto unsForFunctionCompression = getUnsForCompression<D>(
262263 sections, sectionToIdx, sectionIdxsForFunctionCompression,
263264 &duplicateSectionIdxs, maxUN);
0 commit comments