]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Avoid calling range_from_dom when dominator is already resolved.
authorAndrew MacLeod <amacleod@redhat.com>
Fri, 8 Jul 2022 17:30:49 +0000 (13:30 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Mon, 11 Jul 2022 18:41:15 +0000 (14:41 -0400)
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.

gcc/gimple-range-cache.cc

index 9be8bc6123b65d72824b8dbc501b662c8203a8bd..da7b8055d420c3e89b42b4f24455d386b5f875ac 100644 (file)
@@ -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.