public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Jeff Law <law@redhat.com>,
	"richard.sandiford" <richard.sandiford@arm.com>,
	       gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: [RFA] [PR rtl-optimization/90275] Handle nop reg->reg copies in cse
Date: Wed, 05 Feb 2020 12:09:00 -0000	[thread overview]
Message-ID: <20200205120857.GQ22482@gate.crashing.org> (raw)
In-Reply-To: <20200205062603.GV17695@tucnak>

Hi all,

On Wed, Feb 05, 2020 at 07:26:03AM +0100, Jakub Jelinek wrote:
> On Tue, Feb 04, 2020 at 06:04:09PM -0700, Jeff Law wrote:
> > --- a/gcc/cse.c
> > +++ b/gcc/cse.c
> > @@ -5572,6 +5572,16 @@ cse_insn (rtx_insn *insn)
> >  	  sets[i].rtl = 0;
> >  	}
> >  
> > +      /* Similarly for no-op moves.  */

It says "no-op MEM moves" right above, so it should say "no-op REG
moves" here?

> > +      if (n_sets == 1
> > +	  && GET_CODE (src) == REG
> 
> Just nits:
> REG_P (src) ?

Hey that is my nit!  Find your own!  ;-)

> > +	  && src == dest)
> 
> Is pointer comparison ok?

It isn't, it doesn't work for hard registers.

> I mean, shouldn't we instead do
> rtx_equal_p (src, dest),

This does not see e.g.
  (set (reg:SI 123) (subreg:SI (reg:DI 123) 0))
as no-op move.

> set_noop_p (sets[i].rtl)

This doesn't catch all such cases either.

> or noop_move_p (insn)?

And this one is plain wrong (it should be called something with "maybe"
in the name, it returns false if it thinks that may lead to better
optimisation, see the REG_EQUAL handling).

What we need here is a test whether CSE can ignore this insn, and we
will run into this problem if we don't (Jeff's analysis).  Does CSE
already have everything it uses to make that decision scribbled away
somewhere, when we get here?  It would be good if we could use the
exact same condition (same predicate function for example) as what
would lead to the problem later, or we'll be playing whack-a-mole for
a while (or CSE is completely rewritten soon, my preferred option, but
"soon" on a GCC timescale will take way too long for the PR).


Segher

  reply	other threads:[~2020-02-05 12:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05  1:04 Jeff Law
2020-02-05  6:26 ` Jakub Jelinek
2020-02-05 12:09   ` Segher Boessenkool [this message]
2020-02-05 13:31 ` Richard Sandiford
2020-02-06 13:01   ` Jeff Law
2020-02-06 13:57     ` Segher Boessenkool
2020-02-07 16:01       ` Jeff Law
2020-02-08 16:41         ` Segher Boessenkool
2020-03-12 18:03           ` Jeff Law
2020-03-12 18:23             ` Segher Boessenkool
2020-03-12 18:47               ` Jeff Law
2020-03-12 20:26                 ` Segher Boessenkool
2020-03-12 20:56                   ` Jeff Law
2020-03-13 10:29                     ` Richard Sandiford
2020-03-12 22:11               ` Jeff Law
2020-03-13  8:09                 ` Christophe Lyon
2020-03-13 21:49                   ` Jeff Law

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=20200205120857.GQ22482@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=law@redhat.com \
    --cc=richard.sandiford@arm.com \
    /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).