[lld] [lld][ELF] Extend profile guided function ordering to ELF binaries (PR #117514)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 2 10:59:00 PST 2024
================
@@ -1078,8 +1079,17 @@ 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;
+ if (!ctx.arg.irpgoProfileSortProfilePath.empty() ||
+ ctx.arg.functionOrderForCompression || ctx.arg.dataOrderForCompression) {
+ TimeTraceScope timeScope("Balanced Partitioning Section Orderer");
+ sectionOrder = runBalancedPartitioning(
+ ctx, ctx.arg.irpgoProfileSortProfilePath,
+ ctx.arg.functionOrderForCompression, ctx.arg.dataOrderForCompression,
+ ctx.arg.compressionSortStartupFunctions,
+ ctx.arg.verboseBpSectionOrderer);
+ }
// Use the rarely used option --call-graph-ordering-file to sort sections.
- if (!ctx.arg.callGraphProfile.empty())
+ else if (!ctx.arg.callGraphProfile.empty())
----------------
ellishg wrote:
I think you forbid these options from being used together? Then I don't think we need to add the `else`.
https://github.com/llvm/llvm-project/pull/117514
More information about the llvm-commits
mailing list