public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: rep.dot.nop@gmail.com, Andrew MacLeod <amacleod@redhat.com>,
	GCC patches <gcc-patches@gcc.gnu.org>
Subject: Re: [COMMITTED] Kill second order relations in the path solver.
Date: Thu, 28 Oct 2021 01:55:30 +0200	[thread overview]
Message-ID: <20211028015530.6fd3ee60@nbbrfq> (raw)
In-Reply-To: <20211027181323.395724-1-aldyh@redhat.com>

On Wed, 27 Oct 2021 20:13:21 +0200
Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:

[would have to think about this some more but it's late here. Nits:]

> diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc
> index 2acf375ca9a..0ad4f7a9495 100644
> --- a/gcc/value-relation.cc
> +++ b/gcc/value-relation.cc
> @@ -1297,8 +1297,9 @@ path_oracle::killing_def (tree ssa)
>        fprintf (dump_file, "\n");
>      }
>  
> +  unsigned v = SSA_NAME_VERSION (ssa);
>    bitmap b = BITMAP_ALLOC (&m_bitmaps);
> -  bitmap_set_bit (b, SSA_NAME_VERSION (ssa));
> +  bitmap_set_bit (b, v);
>    equiv_chain *ptr = (equiv_chain *) obstack_alloc (&m_chain_obstack,
>  						    sizeof (equiv_chain));
>    ptr->m_names = b;
> @@ -1306,6 +1307,24 @@ path_oracle::killing_def (tree ssa)
>    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.

s/an /and /

> +  if (!bitmap_bit_p (m_relations.m_names, v))
> +    return;
> +
> +  bitmap_clear_bit (m_relations.m_names, v);

IIRC bitmap_clear_bit returns true if the bit was set, false otherwise,
so should be used as if(!bitmap_clear_bit) above.
I would not be surprised if this generates better code as we probably
do not grok to optimize the !bit_p else clear_bit combo. Shame (?).

> +  relation_chain **prev = &(m_relations.m_head);

s/[()]//
thanks,

> +  relation_chain *next = NULL;
> +  for (relation_chain *ptr = m_relations.m_head; ptr; ptr = next)
> +    {
> +      gcc_checking_assert (*prev == ptr);
> +      next = ptr->m_next;
> +      if (SSA_NAME_VERSION (ptr->op1 ()) == v
> +	  || SSA_NAME_VERSION (ptr->op2 ()) == v)
> +	*prev = ptr->m_next;
> +      else
> +	prev = &(ptr->m_next);
> +    }
>  }
>  
>  // Register relation K between SSA1 and SSA2, resolving unknowns by


  parent reply	other threads:[~2021-10-27 23:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27 18:13 Aldy Hernandez
2021-10-27 18:13 ` [COMMITTED] Reorder relation calculating code " Aldy Hernandez
2021-10-27 18:13 ` [COMMITTED] Kill known equivalences before a new assignment " Aldy Hernandez
2021-10-27 23:55 ` Bernhard Reutner-Fischer [this message]
2021-11-01 14:10   ` redundant bitmap_bit_p followed by bitmap_clear_bit [was: Re: [COMMITTED] Kill second order relations in the path solver.] Bernhard Reutner-Fischer
2021-11-01 14:21     ` Aldy Hernandez
2021-11-01 21:02       ` Bernhard Reutner-Fischer
2021-11-02 13:43         ` Richard Biener
2021-11-02 18:01           ` Richard Sandiford
2021-11-02 21:00           ` Bernhard Reutner-Fischer
2021-11-03  8:01             ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211028015530.6fd3ee60@nbbrfq \
    --to=rep.dot.nop@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).