22
22
#include " lld/Common/ErrorHandler.h"
23
23
#include " llvm/ADT/CachedHashString.h"
24
24
#include " llvm/ADT/DenseMap.h"
25
- #include " llvm/ADT/DenseSet .h"
25
+ #include " llvm/ADT/MapVector .h"
26
26
#include " llvm/ADT/SetVector.h"
27
27
#include " llvm/ADT/SmallSet.h"
28
28
#include " llvm/ADT/SmallVector.h"
35
35
#include " llvm/Support/VirtualFileSystem.h"
36
36
#include < memory>
37
37
#include < optional>
38
+ #include < set>
38
39
39
40
#define DEBUG_TYPE " bp-section-orderer"
40
41
@@ -60,7 +61,7 @@ template <class D> struct BPOrderer {
60
61
bool forDataCompression,
61
62
bool compressionSortStartupFunctions, bool verbose,
62
63
llvm::ArrayRef<Section *> sections,
63
- const DenseMap<CachedHashStringRef, DenseSet <unsigned >>
64
+ const DenseMap<CachedHashStringRef, std::set <unsigned >>
64
65
&rootSymbolToSectionIdxs)
65
66
-> llvm::DenseMap<const Section *, int>;
66
67
};
@@ -73,7 +74,7 @@ static SmallVector<std::pair<unsigned, UtilityNodes>> getUnsForCompression(
73
74
ArrayRef<const typename D::Section *> sections,
74
75
const DenseMap<const void *, uint64_t > §ionToIdx,
75
76
ArrayRef<unsigned > sectionIdxs,
76
- DenseMap<unsigned , SmallVector<unsigned >> *duplicateSectionIdxs,
77
+ DenseMap<unsigned , SmallVector<unsigned , 0 >> *duplicateSectionIdxs,
77
78
BPFunctionNode::UtilityNodeT &maxUN) {
78
79
TimeTraceScope timeScope (" Build nodes for compression" );
79
80
@@ -88,7 +89,7 @@ static SmallVector<std::pair<unsigned, UtilityNodes>> getUnsForCompression(
88
89
hashes.clear ();
89
90
}
90
91
91
- DenseMap <uint64_t , unsigned > hashFrequency;
92
+ MapVector <uint64_t , unsigned > hashFrequency;
92
93
for (auto &[sectionIdx, hashes] : sectionHashes)
93
94
for (auto hash : hashes)
94
95
++hashFrequency[hash];
@@ -156,7 +157,7 @@ auto BPOrderer<D>::computeOrder(
156
157
StringRef profilePath, bool forFunctionCompression, bool forDataCompression,
157
158
bool compressionSortStartupFunctions, bool verbose,
158
159
ArrayRef<Section *> sections,
159
- const DenseMap<CachedHashStringRef, DenseSet <unsigned >>
160
+ const DenseMap<CachedHashStringRef, std::set <unsigned >>
160
161
&rootSymbolToSectionIdxs) -> DenseMap<const Section *, int > {
161
162
TimeTraceScope timeScope (" Setup Balanced Partitioning" );
162
163
DenseMap<const void *, uint64_t > sectionToIdx;
@@ -257,7 +258,7 @@ auto BPOrderer<D>::computeOrder(
257
258
258
259
// Map a section index (order directly) to a list of duplicate section indices
259
260
// (not ordered directly).
260
- DenseMap<unsigned , SmallVector<unsigned >> duplicateSectionIdxs;
261
+ DenseMap<unsigned , SmallVector<unsigned , 0 >> duplicateSectionIdxs;
261
262
auto unsForFunctionCompression = getUnsForCompression<D>(
262
263
sections, sectionToIdx, sectionIdxsForFunctionCompression,
263
264
&duplicateSectionIdxs, maxUN);
0 commit comments