On 16/10/25 13:53, [email protected] wrote:
External email: Use caution opening links or attachments


From: Dhruv Chawla <[email protected]>

This patch series is a respin of the RFC originally posted at
https://gcc.gnu.org/pipermail/gcc-patches/2025-June/686835.html.

The patches read the file names from the GCOV file and compare them
against DECL_SOURCE_FILE for symbols to decide which profile count to
annotate them with. The choice between comparing against the full path
or just the file name is decided by param_profile_func_internal_id.

The primary decision is around choosing the file name when there are
clashes for the symbol names with suffixes removed. For example, which
filename is to be chosen for symbol 'effect' when there exist
'effect.lto_priv.0' and 'effect.lto_priv.1'? For this, the symbols in
the current TU named 'effect' are looked up and compared against the function
instances. The one whose file name matches is used for annotation. If
no such match is found, we try looking up a function with the same name that
has no associated filename.

The patches also update the string table reader to strip suffixes when
reading the GCOV file instead of during offline_external_functions ().
This allows tracking clashing names more efficiently.

Signed-off-by: Dhruv Chawla <[email protected]>

Dhruv Chawla (3):
   [AutoFDO] Implement streaming of file names from GCOV profile
   [AutoFDO] Use filenames to resolve clashing symbol names
   [AutoFDO] Update bootstrap gcov_version to 3 and add testcases

  gcc/auto-profile.cc                           | 653 +++++++++++++-----
  gcc/c/Make-lang.in                            |   4 +-
  gcc/cp/Make-lang.in                           |   4 +-
  gcc/lto/Make-lang.in                          |   4 +-
  .../gcc.dg/tree-prof/afdo-lto_priv-basic-0.c  |  47 ++
  .../gcc.dg/tree-prof/afdo-lto_priv-basic-1.c  |  20 +
  .../gcc.dg/tree-prof/afdo-lto_priv-header-0.c |  47 ++
  .../gcc.dg/tree-prof/afdo-lto_priv-header-0.h |   3 +
  .../gcc.dg/tree-prof/afdo-lto_priv-header-1.c |  18 +
  .../gcc.dg/tree-prof/afdo-lto_priv-header-1.h |   3 +
  gcc/testsuite/lib/profopt.exp                 |   2 +-
  11 files changed, 622 insertions(+), 183 deletions(-)
  create mode 100644 gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-basic-0.c
  create mode 100644 gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-basic-1.c
  create mode 100644 gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-0.c
  create mode 100644 gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-0.h
  create mode 100644 gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-1.c
  create mode 100644 gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-1.h

--
2.44.0


Ping (https://gcc.gnu.org/pipermail/gcc-patches/2025-October/697767.html).

--
Regards,
Dhruv

Reply via email to