public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] path relation oracle: Remove SSA's being killed from the equivalence list.
@ 2021-10-28 15:23 Aldy Hernandez
  2021-10-29  7:24 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Aldy Hernandez @ 2021-10-28 15:23 UTC (permalink / raw)
  To: GCC patches

Same thing as the relational change.  Walk any equivalences that have
been registered on the path, and remove the name being killed.  The
only reason we had added the equivalence with itself earlier is so we
wouldn't search any further in the equivalency list.  So if we are
removing all references to it, then we no longer need to add a "kill"
record.

Will push pending tests on x86-64 Linux.

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

gcc/ChangeLog:

	* value-relation.cc (path_oracle::killing_def): Walk the
	equivalency list and remove SSA from any equivalencies.
---
 gcc/value-relation.cc | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc
index 0ad4f7a9495..512b51ce022 100644
--- a/gcc/value-relation.cc
+++ b/gcc/value-relation.cc
@@ -1298,17 +1298,17 @@ path_oracle::killing_def (tree ssa)
     }
 
   unsigned v = SSA_NAME_VERSION (ssa);
-  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;
-  bitmap_ior_into (m_equiv.m_names, b);
 
-  // Walk the relation list an remove SSA from any relations.
+  // 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);
+    }
+
+  // Walk the relation list and remove SSA from any relations.
   if (!bitmap_bit_p (m_relations.m_names, v))
     return;
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] path relation oracle: Remove SSA's being killed from the equivalence list.
  2021-10-28 15:23 [PATCH] path relation oracle: Remove SSA's being killed from the equivalence list Aldy Hernandez
@ 2021-10-29  7:24 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2021-10-29  7:24 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: GCC patches

On Thu, Oct 28, 2021 at 5:25 PM Aldy Hernandez via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Same thing as the relational change.  Walk any equivalences that have
> been registered on the path, and remove the name being killed.  The
> only reason we had added the equivalence with itself earlier is so we
> wouldn't search any further in the equivalency list.  So if we are
> removing all references to it, then we no longer need to add a "kill"
> record.
>
> Will push pending tests on x86-64 Linux.
>
> Co-authored-by: Andrew MacLeod <amacleod@redhat.com>
>
> gcc/ChangeLog:
>
>         * value-relation.cc (path_oracle::killing_def): Walk the
>         equivalency list and remove SSA from any equivalencies.
> ---
>  gcc/value-relation.cc | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc
> index 0ad4f7a9495..512b51ce022 100644
> --- a/gcc/value-relation.cc
> +++ b/gcc/value-relation.cc
> @@ -1298,17 +1298,17 @@ path_oracle::killing_def (tree ssa)
>      }
>
>    unsigned v = SSA_NAME_VERSION (ssa);
> -  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;
> -  bitmap_ior_into (m_equiv.m_names, b);
>
> -  // Walk the relation list an remove SSA from any relations.
> +  // 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);

What's the reason to do both lookup and clear?  Just bitmap_clear_bit ()
should be good enough.

> +    }
> +
> +  // Walk the relation list and remove SSA from any relations.
>    if (!bitmap_bit_p (m_relations.m_names, v))
>      return;
>
> --
> 2.31.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-29  7:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28 15:23 [PATCH] path relation oracle: Remove SSA's being killed from the equivalence list Aldy Hernandez
2021-10-29  7:24 ` Richard Biener

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