]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix profile update after RTL unrolling
authorJan Hubicka <jh@suse.cz>
Thu, 27 Jul 2023 18:06:37 +0000 (20:06 +0200)
committerJan Hubicka <jh@suse.cz>
Thu, 27 Jul 2023 18:08:38 +0000 (20:08 +0200)
commita7d4310aed539b04345894ebafb49ca364780653
tree4eccf9cd5478617b3ebbc73373b75b071244297b
parent081e25d3cfd86c4094999ded0bbe99b91762013c
Fix profile update after RTL unrolling

This patch fixes profile update after RTL unroll, that is now done same way as
in tree one.  We still produce (slightly) corrupted profile for multiple exit
loops I can try to fix incrementally.

I also updated testcases to look for profile mismatches so they do not creep
back in again.

gcc/ChangeLog:

* cfgloop.h (single_dom_exit): Declare.
* cfgloopmanip.h (update_exit_probability_after_unrolling): Declare.
* cfgrtl.cc (struct cfg_hooks): Fix comment.
* loop-unroll.cc (unroll_loop_constant_iterations): Update exit edge.
* tree-ssa-loop-ivopts.h (single_dom_exit): Do not declare it here.
* tree-ssa-loop-manip.cc (update_exit_probability_after_unrolling):
Break out from ...
(tree_transform_and_unroll_loop): ... here;

gcc/testsuite/ChangeLog:

* gcc.dg/tree-prof/peel-1.c: Test for profile mismatches.
* gcc.dg/tree-prof/unroll-1.c: Test for profile mismatches.
* gcc.dg/tree-ssa/peel1.c: Test for profile mismatches.
* gcc.dg/unroll-1.c: Test for profile mismatches.
* gcc.dg/unroll-3.c: Test for profile mismatches.
* gcc.dg/unroll-4.c: Test for profile mismatches.
* gcc.dg/unroll-5.c: Test for profile mismatches.
* gcc.dg/unroll-6.c: Test for profile mismatches.
14 files changed:
gcc/cfgloop.h
gcc/cfgloopmanip.h
gcc/cfgrtl.cc
gcc/loop-unroll.cc
gcc/testsuite/gcc.dg/tree-prof/peel-1.c
gcc/testsuite/gcc.dg/tree-prof/unroll-1.c
gcc/testsuite/gcc.dg/tree-ssa/peel1.c
gcc/testsuite/gcc.dg/unroll-1.c
gcc/testsuite/gcc.dg/unroll-3.c
gcc/testsuite/gcc.dg/unroll-4.c
gcc/testsuite/gcc.dg/unroll-5.c
gcc/testsuite/gcc.dg/unroll-6.c
gcc/tree-ssa-loop-ivopts.h
gcc/tree-ssa-loop-manip.cc