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 r12-1795] Correctly unify recomputation with existing range.
Date: Thu, 24 Jun 2021 17:34:06 +0000 (GMT)	[thread overview]
Message-ID: <20210624173406.2CCA739AD06D@sourceware.org> (raw)

https://gcc.gnu.org/g:5bdcfb74ff97b42f08993af8614c35685fdd8689

commit r12-1795-g5bdcfb74ff97b42f08993af8614c35685fdd8689
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Wed Jun 23 15:25:45 2021 -0400

    Correctly unify recomputation with existing range.
    
    When propagating the on-entry cache, new block ranges are calculated
    by combining all the incoming edges and comparing to the old value.
    When a recomputation was performed on an edge, it didn't take into account
    that the value in the block may already be better than a potential
    recompuation... Thus a worse values was sometimes propagated.
    Fixed by simply calling the now correct range_on_edge the cache provides.
    
            * gimple-range-cache.cc (ranger_cache::propagate_cache): Call
            range_on_edge instead of manually calculating.

Diff:
---
 gcc/gimple-range-cache.cc | 29 +++++++++--------------------
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index a377261c5c7..98ecdbbd68e 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -1037,27 +1037,12 @@ ranger_cache::propagate_cache (tree name)
       new_range.set_undefined ();
       FOR_EACH_EDGE (e, ei, bb->preds)
 	{
+	  range_on_edge (e_range, e, name);
 	  if (DEBUG_RANGE_CACHE)
-	    fprintf (dump_file, "   edge %d->%d :", e->src->index, bb->index);
-	  // Get whatever range we can for this edge.
-	  if (!m_gori.outgoing_edge_range_p (e_range, e, name, *this))
 	    {
-	      exit_range (e_range, name, e->src);
-	      if (DEBUG_RANGE_CACHE)
-		{
-		  fprintf (dump_file, "No outgoing edge range, picked up ");
-		  e_range.dump (dump_file);
-		  fprintf (dump_file, "\n");
-		}
-	    }
-	  else
-	    {
-	      if (DEBUG_RANGE_CACHE)
-		{
-		  fprintf (dump_file, "outgoing range :");
-		  e_range.dump (dump_file);
-		  fprintf (dump_file, "\n");
-		}
+	      fprintf (dump_file, "   edge %d->%d :", e->src->index, bb->index);
+	      e_range.dump (dump_file);
+	      fprintf (dump_file, "\n");
 	    }
 	  new_range.union_ (e_range);
 	  if (new_range.varying_p ())
@@ -1074,7 +1059,11 @@ ranger_cache::propagate_cache (tree name)
 	  if (DEBUG_RANGE_CACHE) 
 	    {
 	      if (!ok_p)
-		fprintf (dump_file, "     Cache failure to store value.");
+		{
+		  fprintf (dump_file, "   Cache failure to store value:");
+		  print_generic_expr (dump_file, name, TDF_SLIM);
+		  fprintf (dump_file, "  ");
+		}
 	      else
 		{
 		  fprintf (dump_file, "      Updating range to ");


                 reply	other threads:[~2021-06-24 17:34 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=20210624173406.2CCA739AD06D@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).