public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] path oracle: Do not look back to the root oracle for killing defs.
@ 2021-10-29 15:52 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2021-10-29 15:52 UTC (permalink / raw)
  To: GCC patches

Since registering a kill means removing all references to it from the
path oracle list, make sure we don't look back to the root oracle
either.

Tested on x86-64 Linux.

Co-authored-by: Andrew MacLeod <amacleod@redhat.com>

gcc/ChangeLog:

	* value-relation.cc (path_oracle::killing_def): Add a
	self-equivalence so we don't look to the root oracle.
---
 gcc/value-relation.cc | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc
index 512b51ce022..f572bcd4dc2 100644
--- a/gcc/value-relation.cc
+++ b/gcc/value-relation.cc
@@ -1302,11 +1302,22 @@ path_oracle::killing_def (tree ssa)
   // Walk the equivalency list and remove SSA from any equivalencies.
   if (bitmap_bit_p (m_equiv.m_names, v))
     {
-      bitmap_clear_bit (m_equiv.m_names, v);
       for (equiv_chain *ptr = m_equiv.m_next; ptr; ptr = ptr->m_next)
 	if (bitmap_bit_p (ptr->m_names, v))
 	  bitmap_clear_bit (ptr->m_names, v);
     }
+  else
+    bitmap_set_bit (m_equiv.m_names, v);
+
+  // Now add an equivalency with itself so we don't look to the root oracle.
+  bitmap b = BITMAP_ALLOC (&m_bitmaps);
+  bitmap_set_bit (b, v);
+  equiv_chain *ptr = (equiv_chain *) obstack_alloc (&m_chain_obstack,
+						    sizeof (equiv_chain));
+  ptr->m_names = b;
+  ptr->m_bb = NULL;
+  ptr->m_next = m_equiv.m_next;
+  m_equiv.m_next = ptr;
 
   // Walk the relation list and remove SSA from any relations.
   if (!bitmap_bit_p (m_relations.m_names, v))
-- 
2.31.1


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

only message in thread, other threads:[~2021-10-29 15:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29 15:52 [COMMITTED] path oracle: Do not look back to the root oracle for killing defs Aldy Hernandez

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