diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2021-11-12 16:08:01 +0100 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2021-11-12 20:42:56 +0100 |
commit | 264f061997c0a5349cdce6d73f0dc167ac7fc8f4 (patch) | |
tree | 47174c21fb162cf48ed57d8a8155b07c51e3d2cd /gcc | |
parent | b301cb43a795884884977703a3767e8765d193d1 (diff) | |
download | gcc-264f061997c0a5349cdce6d73f0dc167ac7fc8f4.zip gcc-264f061997c0a5349cdce6d73f0dc167ac7fc8f4.tar.gz gcc-264f061997c0a5349cdce6d73f0dc167ac7fc8f4.tar.bz2 |
path solver: Solve PHI imports first for ranges.
PHIs must be resolved first while solving ranges in a block,
regardless of where they appear in the import bitmap. We went through
a similar exercise for the relational code, but missed these.
Tested on x86-64 & ppc64le Linux.
gcc/ChangeLog:
PR tree-optimization/103202
* gimple-range-path.cc
(path_range_query::compute_ranges_in_block): Solve PHI imports first.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/gimple-range-path.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc index b9aceaf..71b2904 100644 --- a/gcc/gimple-range-path.cc +++ b/gcc/gimple-range-path.cc @@ -365,12 +365,23 @@ path_range_query::compute_ranges_in_block (basic_block bb) clear_cache (name); } - // Solve imports defined in this block. + // Solve imports defined in this block, starting with the PHIs... + for (gphi_iterator iter = gsi_start_phis (bb); !gsi_end_p (iter); + gsi_next (&iter)) + { + gphi *phi = iter.phi (); + tree name = gimple_phi_result (phi); + + if (import_p (name) && range_defined_in_block (r, name, bb)) + set_cache (r, name); + } + // ...and then the rest of the imports. EXECUTE_IF_SET_IN_BITMAP (m_imports, 0, i, bi) { tree name = ssa_name (i); - if (range_defined_in_block (r, name, bb)) + if (gimple_code (SSA_NAME_DEF_STMT (name)) != GIMPLE_PHI + && range_defined_in_block (r, name, bb)) set_cache (r, name); } |