]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix relation query of equivalences.
authorAndrew MacLeod <amacleod@redhat.com>
Thu, 24 Jun 2021 15:13:47 +0000 (11:13 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Thu, 24 Jun 2021 17:25:58 +0000 (13:25 -0400)
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.

gcc/value-relation.cc

index 3c8698f2a54798ce103cb84c0a0279213f82228d..43fcab7995ae8c91258588a9244ad17c211123d9 100644 (file)
@@ -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));
+      }
 }