public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: 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: Thu, 12 Mar 2020 12:47:04 -0600	[thread overview]
Message-ID: <6450d3fd3267fe014142323a147696503b336857.camel@redhat.com> (raw)
In-Reply-To: <20200312182357.GI22482@gate.crashing.org>

On Thu, 2020-03-12 at 13:23 -0500, Segher Boessenkool wrote:
> 
> > > I don't know if this patch makes matters worse or not.  It doesn't seem
> > > suitable for stage 4 though.  And Richard said the cse.c part breaks
> > > rs6000, if that is true, yes I do object ;-)
> > The rs6000 port breakage is trivial to fix.  In fact, I did so and ran it
> > through
> > my tester, which includes ppc64le and ppc64 a slew of *-elf targets x86
> > native
> > and more.
> 
> I don't see anything rs6000 below?  Is it just this generic code?
It's just generic code.  THe rs6000 issue is fixed by the !CALL_P condition.

> 
> > @@ -5324,9 +5324,11 @@ cse_insn (rtx_insn *insn)
> >  	    }
> >  
> >  	  /* Similarly, lots of targets don't allow no-op
> > -	     (set (mem x) (mem x)) moves.  */
> > +	     (set (mem x) (mem x)) moves.  Even (set (reg x) (reg x))
> > +	     might be impossible for certain registers (like CC registers).  */
> >  	  else if (n_sets == 1
> > -		   && MEM_P (trial)
> > +		   && ! CALL_P (insn)
> > +		   && (MEM_P (trial) || REG_P (trial))
> >  		   && MEM_P (dest)
> >  		   && rtx_equal_p (trial, dest)
> >  		   && !side_effects_p (dest)
> 
> This adds the !CALL_P (no space btw) condition, why is that?
Because n_sets is not valid for CALL_P insns which resulted in a failure on ppc. 
See find_sets_in_insn which ignores the set on the LHS of a call.  So imagine if
we had a nop register set in parallel with a (set (reg) (call ...)).  We'd end up
deleting the entire PARALLEL which is obviously wrong.

One could argue that find_sets_in_insn should be fixed as well.  I'd be worried
about fallout from that.

jeff


  reply	other threads:[~2020-03-12 18:47 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
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 [this message]
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=6450d3fd3267fe014142323a147696503b336857.camel@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.sandiford@arm.com \
    --cc=segher@kernel.crashing.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).