On 12/2/2021 7:53 PM, Eugene Rozenfeld via Gcc-patches wrote:
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 algorithm 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.
Seems quite sensible. I can also easily argue this is a bugfix, even
though there isn't a BZ associated with this issue that I'm aware of.
OK for the trunk.
Thanks,
Jeff