aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-cache.cc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2022-07-08 13:30:49 -0400
committerAndrew MacLeod <amacleod@redhat.com>2022-07-11 14:41:15 -0400
commit12a9b98ac574bc8092a75849b5c462135d35c31d (patch)
tree6792f832b6de61c53b8e63b09ecf6cbe6abc596e /gcc/gimple-range-cache.cc
parentc3ed9e0d6e96d8697e4bab994f8acbc5506240ee (diff)
downloadgcc-12a9b98ac574bc8092a75849b5c462135d35c31d.zip
gcc-12a9b98ac574bc8092a75849b5c462135d35c31d.tar.gz
gcc-12a9b98ac574bc8092a75849b5c462135d35c31d.tar.bz2
Avoid calling range_from_dom when dominator is already resolved.
range_from_dom makes a recursive call to resolve the immediate dominator when there are multiple incoming edges to a block. This is not necessary when the dominator already has an on-entry cache value. PR tree-optimization/106234 * gimple-range-cache.cc (ranger_cache::range_from_dom): Check dominator cache value before recursively resolving it.
Diffstat (limited to 'gcc/gimple-range-cache.cc')
-rw-r--r--gcc/gimple-range-cache.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index 9be8bc6..da7b805 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -1359,10 +1359,11 @@ ranger_cache::range_from_dom (vrange &r, tree name, basic_block start_bb,
m_workback.quick_push (prev_bb);
else if (mode == RFD_FILL)
{
- // Multiple incoming edges, so recursively satisfy this block,
- // store the range, then calculate the incoming range for PREV_BB.
- if (def_bb != bb)
+ // Multiple incoming edges, so recursively satisfy this block
+ // if it doesn't already have a value, and store the range.
+ if (!m_on_entry.bb_range_p (name, bb) && def_bb != bb)
{
+ // If the dominator has not been set, look it up.
range_from_dom (r, name, bb, RFD_FILL);
// If the range can't be store, don't try to accumulate
// the range in PREV_BB due to excessive recalculations.