]> git.ipfire.org Git - thirdparty/gcc.git/commit
Improve AutoFDO count propagation algorithm
authorEugene Rozenfeld <erozen@microsoft.com>
Fri, 3 Dec 2021 02:37:09 +0000 (18:37 -0800)
committerEugene Rozenfeld <erozen@microsoft.com>
Tue, 7 Dec 2021 00:59:31 +0000 (16:59 -0800)
commit3d9e6767939e9658260e2506e81ec32b37cba041
tree5c370b6ac6c2e973dffae64ef2678868dee685e4
parent3a580f967e55733303d2aa29d1f9e75bed81af83
Improve AutoFDO count propagation algorithm

When a basic block A has been annotated with a count and it has only one
successor (or predecessor) B, we can propagate the A's count to B.
The algoritm without this change could leave B without an annotation if B had
other unannotated predecessors (or successors). For example, in the test case I added,
the loop header block was left unannotated, which prevented loop unrolling.

gcc/ChangeLog:
* auto-profile.c (afdo_propagate_edge): Improve count propagation algorithm.

gcc/testsuite/ChangeLog:
* gcc.dg/tree-prof/init-array.c: New test for unrolling inner loops.
gcc/auto-profile.c
gcc/testsuite/gcc.dg/tree-prof/init-array.c [new file with mode: 0644]