From: Aldy Hernandez Date: Wed, 24 Nov 2021 16:58:43 +0000 (+0100) Subject: path solver: Move boolean import code to compute_imports. X-Git-Tag: basepoints/gcc-13~2798 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1c1919ef8a18eea9d5c1741f8c9adaabf5571f2;p=thirdparty%2Fgcc.git path solver: Move boolean import code to compute_imports. In a follow-up patch I will be pruning the set of exported ranges within blocks to avoid unnecessary work. In order to do this, all the interesting SSA names must be in the internal import bitmap ahead of time. I had already abstracted them out into compute_imports, but I missed the boolean code. This fixes the oversight. There's a net gain of 25 threadable paths, which is unexpected but welcome. Tested on x86-64 & ppc64le Linux. gcc/ChangeLog: PR tree-optimization/103254 * gimple-range-path.cc (path_range_query::compute_ranges): Move exported boolean code... (path_range_query::compute_imports): ...here. --- diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc index e24086691c42..806bce9ff11d 100644 --- a/gcc/gimple-range-path.cc +++ b/gcc/gimple-range-path.cc @@ -537,7 +537,8 @@ void path_range_query::compute_imports (bitmap imports, basic_block exit) { // Start with the imports from the exit block... - bitmap r_imports = m_ranger->gori ().imports (exit); + gori_compute &gori = m_ranger->gori (); + bitmap r_imports = gori.imports (exit); bitmap_copy (imports, r_imports); auto_vec worklist (bitmap_count_bits (imports)); @@ -579,6 +580,16 @@ path_range_query::compute_imports (bitmap imports, basic_block exit) } } } + // Exported booleans along the path, may help conditionals. + if (m_resolve) + for (i = 0; i < m_path.length (); ++i) + { + basic_block bb = m_path[i]; + tree name; + FOR_EACH_GORI_EXPORT_NAME (gori, bb, name) + if (TREE_CODE (TREE_TYPE (name)) == BOOLEAN_TYPE) + bitmap_set_bit (imports, SSA_NAME_VERSION (name)); + } } // Compute the ranges for IMPORTS along PATH. @@ -622,18 +633,6 @@ path_range_query::compute_ranges (const vec &path, { basic_block bb = curr_bb (); - if (m_resolve) - { - gori_compute &gori = m_ranger->gori (); - tree name; - - // Exported booleans along the path, may help conditionals. - // Add them as interesting imports. - FOR_EACH_GORI_EXPORT_NAME (gori, bb, name) - if (TREE_CODE (TREE_TYPE (name)) == BOOLEAN_TYPE) - bitmap_set_bit (m_imports, SSA_NAME_VERSION (name)); - } - compute_ranges_in_block (bb); adjust_for_non_null_uses (bb);