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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aol...@gcc.gnu.org>:

https://gcc.gnu.org/g:70f7c603da67adff13e41831ab8ec4e2f6fadc2c

commit r15-5769-g70f7c603da67adff13e41831ab8ec4e2f6fadc2c
Author: Alexandre Oliva <ol...@adacore.com>
Date:   Fri Nov 29 05:42:28 2024 -0300

    ifcombine: avoid unsound forwarder-enabled combinations [PR117723]

    When ifcombining contiguous blocks, we can follow forwarder blocks and
    reverse conditions to enable combinations, but when there are
    intervening blocks, we have to constrain ourselves to paths to the
    exit that share the PHI args with all intervening blocks.

    Avoiding considering forwarders when intervening blocks were present
    would match the preexisting test, but we can do better, recording in
    case a forwarded path corresponds to the outer block's exit path, and
    insisting on not combining through any other path but the one that was
    verified as corresponding.  The latter is what this patch implements.

    While at that, I've fixed some typos, introduced early testing before
    computing the exit path to avoid it when computing it would be
    wasteful, or when avoiding it can enable other sound combinations.


    for  gcc/ChangeLog

            PR tree-optimization/117723
            * tree-ssa-ifcombine.cc (tree_ssa_ifcombine_bb): Record
            forwarder blocks in path to exit, and stick to them.  Avoid
            computing the exit if obviously not needed, and if that
            enables additional optimizations.
            (tree_ssa_ifcombine_bb_1): Fix typos.

    for  gcc/testsuite/ChangeLog

            PR tree-optimization/117723
            * gcc.dg/torture/ifcmb-1.c: New.

Reply via email to