[lld] [lld][InstrProf] Profile guided function order (PR #96268)

Kyungwoo Lee via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 16:34:24 PDT 2024


================
@@ -147,6 +147,14 @@ def cs_profile_path: Joined<["--"], "cs-profile-path=">,
 defm pgo_warn_mismatch: BB<"pgo-warn-mismatch",
   "turn on warnings about profile cfg mismatch (default)",
   "turn off warnings about profile cfg mismatch">, Group<grp_lld>;
+def profile_guided_function_order: Joined<["--"], "profile-guided-function-order=">,
+    MetaVarName<"<profile>">, 
+    HelpText<"Read traces from <profile> to order functions to improve startup time">,
+    Group<grp_lld>;
----------------
kyulee-com wrote:

`profile-guided` seems too generic, and I felt it also might apply to the call graph profile sort/order.
Given you want to order either function or data for compressions, you might also generalize this option instead of just `function` (although currently it only has function traces).

To match the call graph profile sort flag, what about `-irpgo-profile-sort={irpgo profile file}` or `-irpgo-trace-sort={irpgo profile file}` or something? This flag can imply to order function or data to improve the startup time using IRPGO profiles.
As for ordering for compression, you might also consider consolidating them like `-compression-sort=[function|data|both]` or something.

As mentioned in `SectionPriorities.cpp`, I'd make these flags exclusive to the existing call graph profile sort or order file flags.

https://github.com/llvm/llvm-project/pull/96268


More information about the llvm-commits mailing list