aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-path.cc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2021-11-03 08:23:25 +0100
committerAldy Hernandez <aldyh@redhat.com>2021-11-04 15:37:35 +0100
commit5ea1ce43b6070aaa94882e8b15f3340344aaa6b2 (patch)
tree26bb903dd1bad15e6546490500845e75be3e92dc /gcc/gimple-range-path.cc
parent333efaea633971912f2208d37b7b62992759d400 (diff)
downloadgcc-5ea1ce43b6070aaa94882e8b15f3340344aaa6b2.zip
gcc-5ea1ce43b6070aaa94882e8b15f3340344aaa6b2.tar.gz
gcc-5ea1ce43b6070aaa94882e8b15f3340344aaa6b2.tar.bz2
path solver: Only compute relations for imports.
We are currently calculating implicit PHI relations for all PHI arguments. This creates unecessary work, as we only care about SSA names in the import bitmap. Similarly for inter-path relationals. We can avoid things not in the bitmap. Tested on x86-64 and ppc64le Linux with the usual regstrap. I also verified that the before and after number of threads was the same in a suite of .ii files from a bootstrap. gcc/ChangeLog: PR tree-optimization/102943 * gimple-range-path.cc (path_range_query::compute_phi_relations): Only compute relations for SSA names in the import list. (path_range_query::compute_outgoing_relations): Same. * gimple-range-path.h (path_range_query::import_p): New.
Diffstat (limited to 'gcc/gimple-range-path.cc')
-rw-r--r--gcc/gimple-range-path.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc
index d8c2a9b..4230988 100644
--- a/gcc/gimple-range-path.cc
+++ b/gcc/gimple-range-path.cc
@@ -678,8 +678,12 @@ path_range_query::compute_phi_relations (basic_block bb, basic_block prev)
gsi_next (&iter))
{
gphi *phi = iter.phi ();
+ tree result = gimple_phi_result (phi);
unsigned nargs = gimple_phi_num_args (phi);
+ if (!import_p (result))
+ continue;
+
for (size_t i = 0; i < nargs; ++i)
if (e_in == gimple_phi_arg_edge (phi, i))
{
@@ -701,7 +705,8 @@ path_range_query::compute_outgoing_relations (basic_block bb, basic_block next)
if (stmt
&& gimple_code (stmt) == GIMPLE_COND
- && irange::supports_type_p (TREE_TYPE (gimple_cond_lhs (stmt))))
+ && (import_p (gimple_cond_lhs (stmt))
+ || import_p (gimple_cond_rhs (stmt))))
{
int_range<2> r;
gcond *cond = as_a<gcond *> (stmt);