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

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 13:22:13 PDT 2024


================
@@ -352,7 +353,14 @@ void macho::PriorityBuilder::parseOrderFile(StringRef path) {
 DenseMap<const InputSection *, size_t>
 macho::PriorityBuilder::buildInputSectionPriorities() {
   DenseMap<const InputSection *, size_t> sectionPriorities;
-  if (config->callGraphProfileSort) {
+  if (!config->profileGuidedFunctionOrderPath.empty() ||
+      config->functionOrderForCompression || config->dataOrderForCompression) {
+    TimeTraceScope timeScope("Balanced Partitioning Section Orderer");
+    sectionPriorities = runBalancedPartitioning(
----------------
ellishg wrote:

On second thought, I will continue to support using `--irpgo-profile-sort` and `-order_file` together. When both are used, `-order_file` will take precedence and any symbols not ordered by it will be ordered by BP. This is covered by the `bp-section-orderer.s` test.

I will, however, throw an error if `--call-graph-profile-sort` is used with `--irpgo-profile-sort`. I don't expect those to ever be used together. One caveat is `--call-graph-profile-sort` is enabled by default, so I need to check if it's explicitly supplied.

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


More information about the llvm-commits mailing list