diff options
Diffstat (limited to 'lld/ELF/CallGraphSort.cpp')
-rw-r--r-- | lld/ELF/CallGraphSort.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lld/ELF/CallGraphSort.cpp b/lld/ELF/CallGraphSort.cpp index 35c59d6..9caba5c 100644 --- a/lld/ELF/CallGraphSort.cpp +++ b/lld/ELF/CallGraphSort.cpp @@ -235,7 +235,7 @@ DenseMap<const InputSectionBase *, int> CallGraphSort::run() { }); DenseMap<const InputSectionBase *, int> orderMap; - int curOrder = 1; + int curOrder = -clusters.size(); for (int leader : sorted) { for (int i = leader;;) { orderMap[sections[i]] = curOrder++; @@ -276,8 +276,8 @@ DenseMap<const InputSectionBase *, int> CallGraphSort::run() { // Sort sections by the profile data using the Cache-Directed Sort algorithm. // The placement is done by optimizing the locality by co-locating frequently // executed code sections together. -DenseMap<const InputSectionBase *, int> -elf::computeCacheDirectedSortOrder(Ctx &ctx) { +static DenseMap<const InputSectionBase *, int> +computeCacheDirectedSortOrder(Ctx &ctx) { SmallVector<uint64_t, 0> funcSizes; SmallVector<uint64_t, 0> funcCounts; SmallVector<codelayout::EdgeCount, 0> callCounts; @@ -328,7 +328,7 @@ elf::computeCacheDirectedSortOrder(Ctx &ctx) { // Create the final order. DenseMap<const InputSectionBase *, int> orderMap; - int curOrder = 1; + int curOrder = -sortedSections.size(); for (uint64_t secIdx : sortedSections) orderMap[sections[secIdx]] = curOrder++; |