]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix scalng of auto-fdo profiles in liner
authorJan Hubicka <hubicka@ucw.cz>
Thu, 4 Sep 2025 15:23:20 +0000 (17:23 +0200)
committerJan Hubicka <hubicka@ucw.cz>
Thu, 4 Sep 2025 15:25:26 +0000 (17:25 +0200)
commit1da3c4d90e678af0fed89c5638c97a41e5e04547
treedac6ecc0880281a7a583ea017a5869211065da38
parent640fd2f0ccdce4a74f239af818dee409ea7f5587
Fix scalng of auto-fdo profiles in liner

with auto-fdo it is possible that function bar with non-zero profile is inlined
into foo with zero profile and foo is the only caller of it.  In this case
we currently scale bar to also have zero profile which makes it optimized
for size.  With normal profiles this does not happen, since basic blocks with
non-zero count must have some way to be reached.

This patch makes inliner to scale caller in this case which mitigates the
problem (to some degree).

Bootstrapped/regtested x86_64-linux, plan to commit it shortly.

gcc/ChangeLog:

* ipa-inline-transform.cc (inline_call): If function with
AFDO profile is inlined into function with
GUESSED_GLOBAL0_AFDO or GUESSED_GLOBAL0_ADJUSTED, scale
caller to AFDO profile.
* profile-count.h (profile_count::apply_scale): If num is AFDO
and den is not GUESSED, make result AFDO rather then GUESSED.
gcc/ipa-inline-transform.cc
gcc/profile-count.h