aboutsummaryrefslogtreecommitdiff
path: root/lld/ELF/CallGraphSort.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2025-01-09 18:31:57 +0900
committerNAKAMURA Takumi <geek4civic@gmail.com>2025-01-09 18:33:27 +0900
commitdf025ebf872052c0761d44a3ef9b65e9675af8a8 (patch)
tree9b4e94583e2536546d6606270bcdf846c95e1ba2 /lld/ELF/CallGraphSort.cpp
parent4428c9d0b1344179f85a72e183a44796976521e3 (diff)
parentbdcf47e4bcb92889665825654bb80a8bbe30379e (diff)
downloadllvm-users/chapuni/cov/single/loop.zip
llvm-users/chapuni/cov/single/loop.tar.gz
llvm-users/chapuni/cov/single/loop.tar.bz2
Merge branch 'users/chapuni/cov/single/base' into users/chapuni/cov/single/loopusers/chapuni/cov/single/loop
Conflicts: clang/lib/CodeGen/CoverageMappingGen.cpp
Diffstat (limited to 'lld/ELF/CallGraphSort.cpp')
-rw-r--r--lld/ELF/CallGraphSort.cpp8
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++;