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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kyrylo Tkachov <[email protected]>:

https://gcc.gnu.org/g:fd35294ab1dfd4b0bff5fe6a66d383d7cc91f411

commit r17-4988-gfd35294ab1dfd4b0bff5fe6a66d383d7cc91f411
Author: Kyrylo Tkachov <[email protected]>
Date:   Tue Sep 29 16:58:50 2026 +0200

    cprop: Substitute the setter into the jump once per block [PR127661]

    bypass_block substitutes the source of SETCC into the condition of JUMP
    for every incoming edge and register that it tries.  The result does
    not depend on the edge, but each substitution allocates new RTL.  For
    the testcase of the PR, which has N tests, this happens about N*N/2
    times, and after the previous patches it makes most of the garbage that
    cprop allocates.

    JUMP only changes when an edge from BB itself is redirected.  With
    SETCC that never happens, because the new destination is a successor of
    BB and the find_edge (e->src, dest) check then rejects the redirection.
    So this patch does the substitution once, before the loop over the
    incoming edges.  When the known register value decides the jump, the
    substitution in the loop then returns one arm of the jump without
    allocating.

    For the testcase at N=2048 on Grace this cuts the memory that cprop
    allocates by 77%, the peak memory use by 47% and the compile time by a
    further 8%.  The generated code does not change.  The tests added by
    the first patch exercise the new code.

    Bootstrapped and tested as a series on aarch64-linux-gnu and
    x86_64-linux-gnu.

    gcc/ChangeLog:

            PR rtl-optimization/127661
            * cprop.cc (bypass_block): Substitute SETCC into the source of
            JUMP once, before the loop over the incoming edges.

    Signed-off-by: Kyrylo Tkachov <[email protected]>

Reply via email to