public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1796] Fix relation query of equivalences.
@ 2021-06-24 17:34 Andrew Macleod
  0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2021-06-24 17:34 UTC (permalink / raw)
  To: gcc-cvs

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));
+      }
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-24 17:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 17:34 [gcc r12-1796] Fix relation query of equivalences Andrew Macleod

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).