> -----Original Message-----
> From: Prathamesh Kulkarni <[email protected]>
> Sent: 26 March 2026 22:17
> To: Jan Hubicka <[email protected]>
> Cc: [email protected]
> Subject: RE: [RFC][Enable time profile function reordering with
> AutoFDO] Introduce pass ipa_adjust_tp_first_run for handling profiled
> clones
> 
> External email: Use caution opening links or attachments
> 
> 
> > -----Original Message-----
> > From: Jan Hubicka <[email protected]>
> > Sent: 10 March 2026 16:15
> > To: Prathamesh Kulkarni <[email protected]>
> > Cc: [email protected]
> > Subject: Re: [RFC][Enable time profile function reordering with
> > AutoFDO] Introduce pass ipa_adjust_tp_first_run for handling
> profiled
> > clones
> >
> > External email: Use caution opening links or attachments
> >
> >
> > > gcc/ChangeLog:
> > >       * auto-profile.cc: Include lto-streamer.h and data-
> streamer.h.
> > >       (timestamp_info_map): Change value to std::pair<int, int>
> > instead of
> > >       int.
> > >       (autofdo_source_profile::read): Call std::make_pair for
> > populating
> > >       value field of timestamp_info_map.
> > >       (afdo_annotate_cfg): Use it->second.second instead of it-
> > >second for
> > >       assigning value to node->tp_first_run.
> > >       (clone_function_p): New function.
> > >       (clone_timestamp_map): New std::map for storing clone's name
> > and
> > >       tp_first_run which are materialized after auto-profile pass.
> > >       (adjust_tp_first_run_generate_summary): Likewise.
> > >       (adjust_tp_first_run_write_summary): Likewise.
> > >       (adjust_tp_first_run_read_summary): Likewise.
> > >       (adjust_tp_first_run): Likewise.
> > >       (class pass_ipa_adjust_tp_first_run): New pass.
> > >       (make_pass_ipa_adjust_tp_first_run): New function.
> > >       * lto-section-in.cc: Add entry "ipa_adjust_tp_first_run".
> > >       * lto-streamer.h (enum lto_section_type): Add entry for
> > >       LTO_section_ipa_adjust_tp_first_run.
> > >       * passes.def: Add entry for pass_ipa_adjust_tp_first_run.
> > >       * tree-pass.h (make_pass_ipa_adjust_tp_first_run): Declare.
> > OK
> Hi Honza,
> Thanks for the approval, and sorry for late response.
> I made a couple of cosmetic changes to the patch to avoid warnings
> (removing unused variable and using const_cast), and verified the
> patch passes bootstrap+test on aarch64-linux-gnu and x86_64-pc-linux-
> gnu with multilib enabled, and for AutoFDO, I verified the pass gets
> triggered and improves function layout for a large internal workload.
> I am aware it's pretty late in stage-4, but I was hoping it'd be OK to
> commit?
> 
> (The pass added in patch is enabled with -fauto-profile, and it only
> sets node->tp_first_run without affecting function reordering.
> Time profile function reordering is enabled only with -fauto-profile -
> fprofile-reorder-functions).
Hi Honza and Richi,
I am aware it's pretty late in stage-4 now, but was hoping if it'd be OK to 
commit the following patch ?
https://gcc.gnu.org/pipermail/gcc-patches/2026-March/711506.html

The previous version was approved by Honza and this version only adds a couple 
of cosmetic changes that makes it build
without warnings (removing unused variable, and using const_cast).
As mentioned above, the patch passes normal bootstrap+test on aarch64-linux-gnu 
and x86_64-linux-gnu with multilib enabled,
and with AutoFDO, I verified the pass gets triggered and improves function 
layout (resulting in improved perf by ~2-2.5%) for a large internal workload.

The patch is self-contained, it adds a new pass that is enabled with 
-fauto-profile, which only sets node->tp_first_run without
affecting function reordering (and only modifying auto-profile.cc and infra for 
adding a new pass without touching other parts of the codebase).
And time profile function reordering is enabled only with -fauto-profile 
-fprofile-reorder-functions.
Thanks!
> 
> Thanks,
> Prathamesh
> >
> > Honza

Reply via email to