]> git.ipfire.org Git - thirdparty/gcc.git/commit
Improve profile update in merge_blocks
authorJan Hubicka <hubicka@ucw.cz>
Wed, 1 Oct 2025 14:56:15 +0000 (16:56 +0200)
committerJan Hubicka <hubicka@ucw.cz>
Wed, 1 Oct 2025 14:56:15 +0000 (16:56 +0200)
commit8498ef3d0758012bf3e355a61a0f89aff7513851
tree24013d8754ebd83e3e9a5748917d2a7dcefcde56
parentbae9c5e7c6efc0cbed9ea98c4c58bf7ed341f68d
Improve profile update in merge_blocks

When merging blocks we currently alway use count of the first basic block.
In some cases we merge block containing call to cold noreturn function (thus
having count 0 (reliable)) with earlier block with weaker form of profile.
In this case we can still preserve reliable count of 0.

The patch also makes block merging to pick higher of the counts if quality
is the same.  This should reduce chances of losing track of hot code in broken
profiles.

gcc/ChangeLog:

* cfghooks.cc (merge_blocks): Choose more reliable or higher BB
count.
gcc/cfghooks.cc