[gcc(refs/users/aldyh/heads/ranger-relational)] Fix lingering import issues. Build imports at same time as exports.

Andrew Macleod amacleod@gcc.gnu.org
Mon Mar 15 18:12:06 GMT 2021


https://gcc.gnu.org/g:9eb783f05c2633660b43442e825dda8d2e12bf26

commit 9eb783f05c2633660b43442e825dda8d2e12bf26
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Mon Mar 15 10:17:05 2021 -0400

    Fix lingering import issues.  Build imports at same time as exports.

Diff:
---
 gcc/gimple-range-gori.cc | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 22006808828..573d952ffd5 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -356,25 +356,11 @@ gori_map::exports (basic_block bb)
 bitmap
 gori_map::imports (basic_block bb)
 {
-  // If the import doesnt exist, calculate it.
-  if (bb->index >= (signed int)m_incoming.length ())
-    m_incoming.safe_grow_cleared (last_basic_block_for_fn (cfun));
-  if (!m_incoming[bb->index])
-    {
-      m_incoming[bb->index] = BITMAP_ALLOC (&m_bitmaps);
-
-      tree name;
-      FOR_EACH_GORI_EXPORT_NAME (*this, bb, name)
-	{
-	  bitmap imp = get_imports (name);
-	  if (imp)
-	    bitmap_ior_into (m_incoming[bb->index], imp);
-	}
-    }
+  if (bb->index >= (signed int)m_outgoing.length () || !m_outgoing[bb->index])
+    calculate_gori (bb);
   return m_incoming[bb->index];
 }
 
-
 // Return true if NAME is can have ranges generated for it from basic
 // block BB.
 
@@ -404,9 +390,19 @@ gori_map::maybe_add_gori (tree name, basic_block bb)
   if (name)
     {
       gimple *s = SSA_NAME_DEF_STMT (name);
+      bitmap imp = NULL;
       // Check if there is a def chain, and it is in this block.
       if (gimple_bb (s) == bb)
-	add_def_chain_to_bitmap (m_outgoing[bb->index], name);
+	{
+	  add_def_chain_to_bitmap (m_outgoing[bb->index], name);
+	  // Check for any imports.
+	  imp = get_imports (name);
+	}
+      // If there were imports, add them, otherwise this name is an import.
+      if (imp)
+	bitmap_ior_into (m_incoming[bb->index], imp);
+      else
+	bitmap_set_bit (m_incoming[bb->index], SSA_NAME_VERSION (name));
 
       // Def chain doesn't include itself, and even if there isn't a
       // def chain, this name should be added to exports.
@@ -414,6 +410,7 @@ gori_map::maybe_add_gori (tree name, basic_block bb)
     }
 }
 
+
 // Calculate all the required information for BB.
 
 void
@@ -421,9 +418,13 @@ gori_map::calculate_gori (basic_block bb)
 {
   tree name;
   if (bb->index >= (signed int)m_outgoing.length ())
-    m_outgoing.safe_grow_cleared (last_basic_block_for_fn (cfun));
+    {
+      m_outgoing.safe_grow_cleared (last_basic_block_for_fn (cfun));
+      m_incoming.safe_grow_cleared (last_basic_block_for_fn (cfun));
+    }
   gcc_checking_assert (m_outgoing[bb->index] == NULL);
   m_outgoing[bb->index] = BITMAP_ALLOC (&m_bitmaps);
+  m_incoming[bb->index] = BITMAP_ALLOC (&m_bitmaps);
 
   // If this block's last statement may generate range informaiton, go
   // calculate it.


More information about the Gcc-cvs mailing list