]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix afdo profiles for functions that was not early-inlined
authorJan Hubicka <hubicka@ucw.cz>
Fri, 27 Jun 2025 14:10:31 +0000 (16:10 +0200)
committerJan Hubicka <hubicka@ucw.cz>
Fri, 27 Jun 2025 14:18:53 +0000 (16:18 +0200)
commitad18f7f88aee15b3f15aa74483ca2ebdc89e18cb
tree0bc78493993036550f40478541f5672cd0211301
parent49d58d8da2281ec66c376ca998d29652e417f4cd
Fix afdo profiles for functions that was not early-inlined

This patch should finish the oflining infrastructure by offlining
(prior AFDO annotation) all inline function instances that was not
early inlined.  This is mostly the case of recursive inlining or when
-fno-auto-profile-inlining is used which sould now produce comparable
code.

I also cleaned up offlining of self-recursive functions which now
happens through the worklist and reduces problem with recursive ivocation
of the funciton merging modifying datastructures at unexpected places.

gcc/ChangeLog:

* auto-profile.cc (function_instance::set_name,
function_instance::set_realized, function_instnace::realized_p,
function_instance::set_in_worklist,
function_instance::clear_in_worklist,
function_instance::in_worklist_p): New member functions.
(function_instance::in_worklist, function_instance::realized_):
new.
(get_relative_location_for_locus): Break out from ....
(get_relative_location_for_stmt): ... here.
(function_instance::~function_instance): Sanity check that
removed function is not in worklist.
(function_instance::merge): Do not offline realized instances.
(function_instance::offline): Make private; add duplicate functions
to worklist rather then merging immediately.
(function_instance::offline_if_in_set):  Cleanup.
(function_instance::remove_external_functions): Likewise.
(function_instance::offline_if_not_realized): New member function.
(autofdo_source_profile::offline_external_functions): Handle delayed
functions.
(autofdo_source_profile::offline_unrealized_inlines): New member function.
(walk_block): New function.
(mark_realized_functions): New function.
(afdo_annotate_cfg): Fix dump.
(auto_profile): Mark realized functions and offline rest; do not compute
fn summary.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-prof/afdo-crossmodule-1.c: Update template.
gcc/auto-profile.cc
gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1.c