Add an unreachable_path_p method to path_range_query.
authorAldy Hernandez <aldyh@redhat.com>
Sun, 5 Sep 2021 10:44:41 +0000 (12:44 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Sun, 5 Sep 2021 11:43:51 +0000 (13:43 +0200)
commit90ef15352701c6880faee83a46031d7837ab9d27
treee18207c6fd09f3dd67335e1a264e5fdb236993c3
parentcbeeadff4c041c09a6335105d596019b6d583880
Add an unreachable_path_p method to path_range_query.

Keeping track of unreachable calculations while traversing a path is
useful to determine edge reachability, among other things.  We've been
doing this ad-hoc in the backwards threader, so this provides a cleaner
way of accessing the information.

This patch also makes it easier to compare different threading
implementations, in some upcoming work.  For example, it's currently
difficult to gague how good we're doing compared to the forward threader,
because it can thread paths that are obviously unreachable.  This
provides a way of discarding those paths.

Note that I've opted to keep unreachable_path_p() out-of-line, because I
have local changes that will enhance this method.

Tested on x86-64 Linux.

gcc/ChangeLog:

* gimple-range-path.cc (path_range_query::range_of_expr): Set
m_undefined_path when appropriate.
(path_range_query::internal_range_of_expr): Copy from range_of_expr.
(path_range_query::unreachable_path_p): New.
(path_range_query::precompute_ranges): Set m_undefined_path.
* gimple-range-path.h (path_range_query::unreachable_path_p): New.
(path_range_query::internal_range_of_expr): New.
* tree-ssa-threadbackward.c (back_threader::find_taken_edge_cond):
Use unreachable_path_p.
gcc/gimple-range-path.cc
gcc/gimple-range-path.h
gcc/tree-ssa-threadbackward.c