]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/116166 - forward jump-threading going wild
authorRichard Biener <rguenther@suse.de>
Tue, 6 Aug 2024 12:56:26 +0000 (14:56 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 7 Aug 2024 07:14:21 +0000 (09:14 +0200)
commit2cf89ae83225f932b226cd57ef2d083a59bcf8a3
tree857a35b6beba26d9dc69ac800ef6a8aaa1015b2b
parent9db55ec0547e171eed8e7a7c50c8dad79d62fd65
tree-optimization/116166 - forward jump-threading going wild

Currently the forward threader isn't limited as to the search space
it explores and with it now using path-ranger for simplifying
conditions it runs into it became pretty slow for degenerate cases
like compiling insn-emit.cc for RISC-V esp. when compiling for
a host with LOGICAL_OP_NON_SHORT_CIRCUIT disabled.

The following makes the forward threader honor the search space
limit I introduced for the backward threader.  This reduces
compile-time from minutes to seconds for the testcase in PR116166.

Note this wasn't necessary before we had ranger but with ranger
the work we do is quadatic in the length of the threading path
we build up (the same is true for the backwards threader).

PR tree-optimization/116166
* tree-ssa-threadedge.h (jump_threader::thread_around_empty_blocks):
Add limit parameter.
(jump_threader::thread_through_normal_block): Likewise.
* tree-ssa-threadedge.cc (jump_threader::thread_around_empty_blocks):
Honor and decrement limit parameter.
(jump_threader::thread_through_normal_block): Likewise.
(jump_threader::thread_across_edge): Initialize limit from
param_max_jump_thread_paths and pass it down to workers.
gcc/tree-ssa-threadedge.cc
gcc/tree-ssa-threadedge.h