[ELF] Internalize computeCacheDirectedSortOrder. NFC

and delete an incorremtn comment about ctx.arg.callGraphProfile
This commit is contained in:
Fangrui Song 2025-01-05 16:19:09 -08:00
parent c2f7745b4e
commit 8d2b070f07
3 changed files with 2 additions and 6 deletions

View File

@ -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;

View File

@ -15,9 +15,6 @@ namespace lld::elf {
struct Ctx;
class InputSectionBase;
llvm::DenseMap<const InputSectionBase *, int>
computeCacheDirectedSortOrder(Ctx &);
llvm::DenseMap<const InputSectionBase *, int>
computeCallGraphProfileOrder(Ctx &);
} // namespace lld::elf

View File

@ -1083,7 +1083,6 @@ static void maybeShuffle(Ctx &ctx,
// Builds section order for handling --symbol-ordering-file.
static DenseMap<const InputSectionBase *, int> buildSectionOrder(Ctx &ctx) {
DenseMap<const InputSectionBase *, int> sectionOrder;
// Use the rarely used option --call-graph-ordering-file to sort sections.
if (!ctx.arg.callGraphProfile.empty())
return computeCallGraphProfileOrder(ctx);