From 8d2b070f07969f8358c93b9cf56834806fdc3efa Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 5 Jan 2025 16:19:09 -0800 Subject: [PATCH] [ELF] Internalize computeCacheDirectedSortOrder. NFC and delete an incorremtn comment about ctx.arg.callGraphProfile --- lld/ELF/CallGraphSort.cpp | 4 ++-- lld/ELF/CallGraphSort.h | 3 --- lld/ELF/Writer.cpp | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lld/ELF/CallGraphSort.cpp b/lld/ELF/CallGraphSort.cpp index 35c59d6edb2a..0b1b4196de37 100644 --- a/lld/ELF/CallGraphSort.cpp +++ b/lld/ELF/CallGraphSort.cpp @@ -276,8 +276,8 @@ DenseMap 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 -elf::computeCacheDirectedSortOrder(Ctx &ctx) { +static DenseMap +computeCacheDirectedSortOrder(Ctx &ctx) { SmallVector funcSizes; SmallVector funcCounts; SmallVector callCounts; diff --git a/lld/ELF/CallGraphSort.h b/lld/ELF/CallGraphSort.h index 5f9987ce0973..89e6f617d921 100644 --- a/lld/ELF/CallGraphSort.h +++ b/lld/ELF/CallGraphSort.h @@ -15,9 +15,6 @@ namespace lld::elf { struct Ctx; class InputSectionBase; -llvm::DenseMap -computeCacheDirectedSortOrder(Ctx &); - llvm::DenseMap computeCallGraphProfileOrder(Ctx &); } // namespace lld::elf diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 3e92b7653e31..0ea2e60d8482 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1083,7 +1083,6 @@ static void maybeShuffle(Ctx &ctx, // Builds section order for handling --symbol-ordering-file. static DenseMap buildSectionOrder(Ctx &ctx) { DenseMap sectionOrder; - // Use the rarely used option --call-graph-ordering-file to sort sections. if (!ctx.arg.callGraphProfile.empty()) return computeCallGraphProfileOrder(ctx);