[all-commits] [llvm/llvm-project] 15faa0: [SampleProfileMatcher] Fix direct basename matchin...
Farid Zakaria via All-commits
all-commits at lists.llvm.org
Mon Sep 28 20:43:20 PDT 2026
Branch: refs/heads/users/fmzakari/sample-profiler-matcher
Home: https://github.com/llvm/llvm-project
Commit: 15faa0abc25e192a6488e7a6f8e2194a7c236550
https://github.com/llvm/llvm-project/commit/15faa0abc25e192a6488e7a6f8e2194a7c236550
Author: Farid Zakaria <fmzakari at fb.com>
Date: 2026-09-28 (Mon, 28 Sep 2026)
Changed paths:
M llvm/lib/Transforms/IPO/SampleProfileMatcher.cpp
A llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-stale-profile-direct-basename-suffix.prof
A llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-stale-profile-direct-basename-uniq.prof
A llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-direct-basename-suffix.ll
A llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-direct-basename-uniq.ll
Log Message:
-----------
[SampleProfileMatcher] Fix direct basename matching for suffixed function names
Direct basename matching (#184409) silently skips any function whose name
carries a suffix, for two reasons:
1. `getDemangledBaseName` demangles the raw name. For names such as
`_ZL3fool.__uniq.123`, `_Z3fool.llvm.7`, `.part.N` or `.cfi` the Itanium
demangler's root node is a DotSuffix, for which `getFunctionBaseName()`
returns null, so the function is never a candidate on either the IR or
the profile side.
2. `UpdateWithSalvagedProfiles` keys `FuncNameToProfNameMap` by the raw IR
name, but `SampleProfileReader::getSamplesFor(const Function &)` looks it
up by `getCanonicalFnName`. A salvaged `.llvm.N` (ThinLTO-promoted),
`.part.N` or `.cfi` function therefore still gets no profile.
Canonicalize the name before demangling (additionally dropping `.__uniq.N`,
which `getCanonicalFnName` keeps when the profile has uniq names), and key
the map by the canonical name. Other suffixes such as coroutine `.resume`
are kept so those clones do not make a basename ambiguous.
The `.__uniq.N` case matters most in practice. The suffix hashes the source
path (`-funique-internal-linkage-names`), so moving or renaming a file
renames every internal-linkage function in it, and these are exactly the
functions basename matching is meant to recover. In CSSPGO profiles from two
large production services, `.__uniq.` functions are 17.4% and 8.6% of
top-level profiles but carry 39.9% and 29.2% of the samples: internal
functions are few, but they are small hot helpers, so their sample density
is 2.3x-3.4x that of the average function. Today all of them are excluded
from basename matching.
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