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-1796] Fix relation query of equivalences.
Date: Thu, 24 Jun 2021 17:34:11 +0000 (GMT)	[thread overview]
Message-ID: <20210624173411.43C2139AD07C@sourceware.org> (raw)

https://gcc.gnu.org/g:ce0b409f562cd09c67cc2dce74143a0f0647cde5

commit r12-1796-gce0b409f562cd09c67cc2dce74143a0f0647cde5
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Thu Jun 24 11:13:47 2021 -0400

    Fix relation query of equivalences.
    
    When looking for relations between equivalencies, a typo was causing
    the wrong bitmap to be checked. Effect was is missed them.
    Plus don't dump blocks which don't exist.
    
            * value-relation.cc (equiv_oracle::dump): Do not dump NULL blocks.
            (relation_oracle::find_relation_block): Check correct bitmap.
            (relation_oracle::dump): Do not dump NULL blocks.

Diff:
---
 gcc/value-relation.cc | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc
index 3c8698f2a54..43fcab7995a 100644
--- a/gcc/value-relation.cc
+++ b/gcc/value-relation.cc
@@ -444,7 +444,7 @@ equiv_oracle::dump (FILE *f) const
 {
   fprintf (f, "Equivalency dump\n");
   for (unsigned i = 0; i < m_equiv.length (); i++)
-    if (m_equiv[i])
+    if (m_equiv[i] && BASIC_BLOCK_FOR_FN (cfun, i))
       {
 	fprintf (f, "BB%d\n", i);
 	dump (f, BASIC_BLOCK_FOR_FN (cfun, i));
@@ -757,9 +757,9 @@ relation_oracle::find_relation_block (unsigned bb, const_bitmap b1,
     {
       unsigned op1 = SSA_NAME_VERSION (ptr->op1 ());
       unsigned op2 = SSA_NAME_VERSION (ptr->op2 ());
-      if (bitmap_bit_p (b1, op1) && bitmap_bit_p (b1, op2))
+      if (bitmap_bit_p (b1, op1) && bitmap_bit_p (b2, op2))
 	return ptr->kind ();
-      if (bitmap_bit_p (b1, op2) && bitmap_bit_p (b1, op1))
+      if (bitmap_bit_p (b1, op2) && bitmap_bit_p (b2, op1))
 	return relation_swap (ptr->kind ());
     }
 
@@ -925,8 +925,9 @@ relation_oracle::dump (FILE *f) const
 {
   fprintf (f, "Relation dump\n");
   for (unsigned i = 0; i < m_relations.length (); i++)
-    {
-      fprintf (f, "BB%d\n", i);
-      dump (f, BASIC_BLOCK_FOR_FN (cfun, i));
-    }
+    if (BASIC_BLOCK_FOR_FN (cfun, i))
+      {
+	fprintf (f, "BB%d\n", i);
+	dump (f, BASIC_BLOCK_FOR_FN (cfun, i));
+      }
 }


                 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=20210624173411.43C2139AD07C@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).