diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2020-12-10 14:59:14 -0500 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2020-12-10 16:35:01 -0500 |
commit | 7f359556a772e26eabf8d31e53aae1de6f2f200d (patch) | |
tree | 4d312d4baac672782765ef7cfa91b61d20eeb25a /gcc/gimple-range-cache.cc | |
parent | 779bf1823ced0814803d2be7f7ded0317e70140c (diff) | |
download | gcc-7f359556a772e26eabf8d31e53aae1de6f2f200d.zip gcc-7f359556a772e26eabf8d31e53aae1de6f2f200d.tar.gz gcc-7f359556a772e26eabf8d31e53aae1de6f2f200d.tar.bz2 |
Reduce memory requirements for ranger
Calculate block exit info upfront, and then any SSA_NAME which is never
used in an outgoing range calculation is a pure global and can bypass the
on-entry cache.
PR tree-optimization/98174
* gimple-range-cache.cc (ranger_cache::ssa_range_in_bb): Only push
poor values to be examined if it isn't a pure global.
(ranger_cache::block_range): Don't process pure globals.
(ranger_cache::fill_block_cache): Adjust has_edge_range call.
* gimple-range-gori.cc (gori_map::all_outgoing): New bitmap.
(gori_map::gori_map): Allocate all_outgoing.
(gori_map::is_export_p): No specified BB returns global context.
(gori_map::calculate_gori): Accumulate each block into global.
(gori_compute::gori_compute): Preprocess each block for exports.
(gori_compute::has_edge_range_p): No edge returns global context.
* gimple-range-gori.h (has_edge_range_p): Provide default parameter.
Diffstat (limited to 'gcc/gimple-range-cache.cc')
-rw-r--r-- | gcc/gimple-range-cache.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index b01563c..edebad4 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -779,8 +779,10 @@ ranger_cache::ssa_range_in_bb (irange &r, tree name, basic_block bb) // Look for the on-entry value of name in BB from the cache. else if (!m_on_entry.get_bb_range (r, name, bb)) { - // If it has no entry then mark this as a poor value. - if (push_poor_value (bb, name)) + // If it has no entry but should, then mark this as a poor value. + // Its not a poor value if it does not have *any* edge ranges, + // Then global range is as good as it gets. + if (has_edge_range_p (name) && push_poor_value (bb, name)) { if (DEBUG_RANGE_CACHE) { @@ -812,6 +814,11 @@ ranger_cache::block_range (irange &r, basic_block bb, tree name, bool calc) { gcc_checking_assert (gimple_range_ssa_p (name)); + // If there are no range calculations anywhere in the IL, global range + // applies everywhere, so don't bother caching it. + if (!has_edge_range_p (name)) + return false; + if (calc) { gimple *def_stmt = SSA_NAME_DEF_STMT (name); @@ -1072,7 +1079,7 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb) { if (DEBUG_RANGE_CACHE) fprintf (dump_file, "has cache, "); - if (!r.undefined_p () || has_edge_range_p (e, name)) + if (!r.undefined_p () || has_edge_range_p (name, e)) { add_to_update (node); if (DEBUG_RANGE_CACHE) |