https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110590

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jan Hubicka <hubi...@gcc.gnu.org>:

https://gcc.gnu.org/g:15bbf1826a01f5beb2d7c0f74d6270bbc94ece91

commit r14-2396-g15bbf1826a01f5beb2d7c0f74d6270bbc94ece91
Author: Jan Hubicka <j...@suse.cz>
Date:   Sat Jul 8 17:38:09 2023 +0200

    Fix tree-ssa/update-cunroll.c

    In this testcase the profile is misupdated before loop has two exits.
    The first exit is one eliminated by complete unrolling while second exit
remains.
    We remove first exit but forget about fact that the source BB of other exit
will
    then have higher frequency making other exit more likely.

    This patch fixes that in duplicate_loop_body_to_header_edge.
    While looking into resulting profiles I also noticed that in some cases
    scale_loop_profile may drop probabilities to 0 incorrectly either when
    trying to update exit from nested loop (which has similar problem) or when
the profile
    was inconsistent as described in coment bellow.

    gcc/ChangeLog:

            PR middle-end/110590
            * cfgloopmanip.cc (scale_loop_profile): Avoid scaling exits within
            inner loops and be more careful about inconsistent profiles.
            (duplicate_loop_body_to_header_edge): Fix profile update when
eliminated
            exit is followed by other exit.

    gcc/testsuite/ChangeLog:

            PR middle-end/110590
            * gcc.dg/tree-prof/update-cunroll-2.c: Remove xfail.
            * gcc.dg/tree-ssa/update-cunroll.c: Likewise.

Reply via email to