]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/tree-ssa-threadbackward.cc
Make path_range_query standalone and add reset_path.
authorAldy Hernandez <aldyh@redhat.com>
Wed, 17 Aug 2022 11:18:01 +0000 (13:18 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Thu, 18 Aug 2022 14:38:00 +0000 (16:38 +0200)
commit011d0a033ab370ea38b06b813ac62be8dde0801b
treeb0abbeb3bea4d27cd333a9e07264c5f8511024a1
parentac68f904fe31baf80fa53218f1d8ee033bd8c79b
Make path_range_query standalone and add reset_path.

These are a bunch of cleanups inspired by Richi's suggestion of making
path_range_query standalone, instead of having to call
compute_ranges() for each path.

I've made the ranger need explicit, and moved the responsibility for
its creation to the caller.

I've also investigated and documented why the forward threader needs its
own compute exit dependencies variant.  I can't wait for it to go away
:-/.

I've also added constructors that take a path and dependencies, and
made compute_ranges() private.  Unfortunately, reinstantiating
path_range_query in the forward threader caused a 14% performance
regression in DOM, because the old threader calls it over and over on
the same path to simplify statements (some of which not even in the
IL, but that's old news).

In the meantime, I've left the ability to reset a path, but this time
appropriately called reset_path().

Tested, benchmarked, and thread counted on x86-64 Linux.

gcc/ChangeLog:

* gimple-range-path.cc (path_range_query::path_range_query): Add
various constructors to take a path.
(path_range_query::~path_range_query): Remove m_alloced_ranger.
(path_range_query::range_on_path_entry): Adjust for m_ranger being
a reference.
(path_range_query::set_path): Rename to...
(path_range_query::reset_path): ...this and call compute_ranges.
(path_range_query::ssa_range_in_phi): Adjust for m_ranger
reference.
(path_range_query::range_defined_in_block): Same.
(path_range_query::compute_ranges_in_block): Same.
(path_range_query::adjust_for_non_null_uses): Same.
(path_range_query::compute_exit_dependencies): Use m_path instead
of argument.
(path_range_query::compute_ranges): Remove path argument.
(path_range_query::range_of_stmt): Adjust for m_ranger reference.
(path_range_query::compute_outgoing_relations): Same.
* gimple-range-path.h (class path_range_query): Add various
constructors.
Make compute_ranges and compute_exit_dependencies private.
Rename set_path to reset_path.
Make m_ranger a reference.
Remove m_alloced_ranger.
* tree-ssa-dom.cc (pass_dominator::execute): Adjust constructor to
path_range_query.
* tree-ssa-loop-ch.cc (entry_loop_condition_is_static): Take a
ranger and instantiate a new path_range_query every time.
(ch_base::copy_headers): Pass ranger instead of path_range_query.
* tree-ssa-threadbackward.cc (class back_threader): Remove m_solver.
(back_threader::~back_threader): Remove m_solver.
(back_threader::find_taken_edge_switch): Adjust for m_ranger
reference.
(back_threader::find_taken_edge_cond): Same.
(back_threader::dump): Remove m_solver.
(back_threader::back_threader): Move verify_marked_backedges
here from the path_range_query constructor.
* tree-ssa-threadedge.cc (hybrid_jt_simplifier::simplify): Move
some code from compute_ranges_from_state here.
(hybrid_jt_simplifier::compute_ranges_from_state): Rename...
(hybrid_jt_simplifier::compute_exit_dependencies): ...to this.
* tree-ssa-threadedge.h (class hybrid_jt_simplifier): Rename
compute_ranges_from_state to compute_exit_dependencies.
Remove m_path.
gcc/gimple-range-path.cc
gcc/gimple-range-path.h
gcc/tree-ssa-dom.cc
gcc/tree-ssa-loop-ch.cc
gcc/tree-ssa-threadbackward.cc
gcc/tree-ssa-threadedge.cc
gcc/tree-ssa-threadedge.h