[all-commits] [llvm/llvm-project] 83632c: [lld][BP] Order .Tgm symbols for startup (#126328)

Ellis Hoag via All-commits all-commits at lists.llvm.org
Thu Feb 13 12:11:19 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 83632c039d17772769617b92a1658e8a98190c5e
      https://github.com/llvm/llvm-project/commit/83632c039d17772769617b92a1658e8a98190c5e
  Author: Ellis Hoag <ellis.sparky.hoag at gmail.com>
  Date:   2025-02-13 (Thu, 13 Feb 2025)

  Changed paths:
    M lld/include/lld/Common/BPSectionOrdererBase.inc
    M lld/test/MachO/bp-section-orderer.s

  Log Message:
  -----------
  [lld][BP] Order .Tgm symbols for startup (#126328)

The Global Function Merger
(https://discourse.llvm.org/t/rfc-global-function-merging/82608) pass
optimistically creates merged instances of functions and suffixes their
names with `.Tgm`. Then in the linker, ICF will (hopefully) fold these
`.Tgm` functions. For example, a function `foo` might become a thunk
`foo` that calls a merged function `foo.Tgm`.

Since IRPGO runs before the global merger, we will only have a profile
for `foo`. We want to correlate this profile to both `foo` and `foo.Tgm`
so they can both be ordered to improve startup time.

I built a large binary and found that it increased the number of
functions ordered for startup, as expected.
```
Functions for startup: 12049 -> 12697
Functions for compression: 34733 -> 34707
```

The reason why we don't see a larger improvement is because there are
some cases where the code was accidentally working:
`getRootSymbol("foo.llvm.5555.Tgm")` already returns `foo`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list