[PATCH 3/5] cprop: Substitute the setter into the jump once per block [PR127661]
Jeff Law
jeffrey.law@oss.qualcomm.com
Thu Oct 8 02:16:29 GMT 2026
On 10/6/26 3:34 AM, ktkachov@nvidia.com wrote:
> From: Kyrylo Tkachov <ktkachov@nvidia.com>
>
> 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.
>
> Ok for trunk?
> Thanks,
> Kyrill
>
> Cc: Jeff Law <jeffrey.law@oss.qualcomm.com>
>
> 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 <ktkachov@nvidia.com>
OK
jeff
More information about the Gcc-patches
mailing list