Files
Peter Rong bb82a7a872 [MemProf] Skip GV __prof* during instrumentation (#193354)
The existing filter in `isInterestingMemoryAccess` skips globals named
`__llvm*`, but PGO counter globals are named `__profc_*` (and related
`__profd_*`, `__profvp_*`, etc.), so they bypass the name check, e.g.:


b48d8a54e2/llvm/include/llvm/ProfileData/InstrProf.h (L128-L138)

The section-based check above catches direct accesses where
`stripInBoundsOffsets` resolves to the GlobalVariable, but fails for
bias-based counter addressing `(inttoptr(add(ptrtoint(__profc_),
bias)))` which the strip cannot see through.

This causes MemProf to instrument PGO counter updates, inflating MGO
binary access profiles proportionally to __llvm_prf_cnts section size.
Filtering `__prof` prefixed globals closes this gap.

RFC: we have confirmed `__prof*` are dead weight, whether we should
block `llvm.*` like `InstrProfiling.cpp` did is an open question for ppl
familiar with MemProf, e.g.:


b48d8a54e2/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp (L1518-L1521)
2026-04-29 15:19:12 -07:00
..