[all-commits] [llvm/llvm-project] 5c881d: [ProfileData] Only keep module functions when read...

Farid Zakaria via All-commits all-commits at lists.llvm.org
Mon Sep 28 15:06:41 PDT 2026


  Branch: refs/heads/users/fmzakari/psl-module-filter
  Home:   https://github.com/llvm/llvm-project
  Commit: 5c881d402c2da8acaf8a6f5ada8fb1dd21014f3f
      https://github.com/llvm/llvm-project/commit/5c881d402c2da8acaf8a6f5ada8fb1dd21014f3f
  Author: Farid Zakaria <fmzakari at meta.com>
  Date:   2026-09-28 (Mon, 28 Sep 2026)

  Changed paths:
    M llvm/include/llvm/ProfileData/SampleProf.h
    M llvm/lib/ProfileData/SampleProf.cpp
    M llvm/lib/ProfileData/SampleProfReader.cpp
    A llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-stale-profile-symbol-list.text
    A llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-symbol-list.ll

  Log Message:
  -----------
  [ProfileData] Only keep module functions when reading ProfileSymbolList

When a sample profile is loaded for a module (SampleProfileLoader), the
profile symbol list is only ever queried for functions of that module:
`PSL->contains(F.getName())` in SampleProfileLoader and
`PSL->contains(CanonFName)` in SampleProfileMatcher. Yet the string-based
reader inserts every symbol of the profiled binary into a DenseSet, in every
compile and every ThinLTO backend that loads the profile.

When the reader has a module, build a small set of that module's function
names (raw and canonical) and only add matching list entries. The list is
still scanned, but nothing outside the module is inserted, so there is no
large hash table to build. Readers without a module (llvm-profdata) still
load the full list. The MD5 symbol list is unaffected.

In a fleet-wide CPU profile of a production clang,
`ProfileSymbolList::read` accounted for 1.7% of all clang cycles and 10% of
ThinLTO backend cycles.

`opt -passes=sample-profile` on a 2-function module, synthetic ext-binary
profiles with a symbol list attached via `llvm-profdata merge --extbinary
--prof-sym-list`, `perf stat -r 10`:

  symbol list                  before    after
  1M names                      87 ms    29 ms
  4M names                     376 ms    96 ms   (max RSS 376 MB -> 246 MB)
  4M names, compressed         887 ms   606 ms
  real CSSPGO profile (218K)   361 ms   338 ms

Assisted-by: Claude



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