public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Macleod <amacleod@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-1608] Avoid calling range_from_dom when dominator is already resolved.
Date: Mon, 11 Jul 2022 18:44:00 +0000 (GMT)	[thread overview]
Message-ID: <20220711184400.57D3E3858D1E@sourceware.org> (raw)

https://gcc.gnu.org/g:12a9b98ac574bc8092a75849b5c462135d35c31d

commit r13-1608-g12a9b98ac574bc8092a75849b5c462135d35c31d
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Fri Jul 8 13:30:49 2022 -0400

    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.

Diff:
---
 gcc/gimple-range-cache.cc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index 9be8bc6123b..da7b8055d42 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.


                 reply	other threads:[~2022-07-11 18:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220711184400.57D3E3858D1E@sourceware.org \
    --to=amacleod@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).