public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Jeff Law <law@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] loop-invariant: JUMP_INSNs aren't loop invariant [PR97954]
Date: Tue, 1 Dec 2020 11:06:25 +0100 (CET)	[thread overview]
Message-ID: <nycvar.YFH.7.76.2012011106180.17979@zhemvz.fhfr.qr> (raw)
In-Reply-To: <20201201084801.GP3788@tucnak>

On Tue, 1 Dec 2020, Jakub Jelinek wrote:

> Hi!
> 
> The following testcase ICEs because loop invariant motion moves asm goto
> with a single output as invariant.
> Normally, jumps aren't really moved, because if they are single set,
> they have their SET_DEST (pc) and pc_rtx has VOIDmode on which one of the
> functions find_invariant_insn calls bails out.  The code already punts on
> insns that can throw or trap.  And for asm goto without outputs, it isn't
> single set, or asm goto with two or more outputs it isn't single set either.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?

OK.

Thanks,
Richard.

> 2020-12-01  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR rtl-optimization/97954
> 	* loop-invariant.c (find_invariant_insn): Punt on JUMP_P insns.
> 
> 	* gcc.dg/pr97954.c: New test.
> 
> --- gcc/loop-invariant.c.jj	2020-01-12 11:54:36.000000000 +0100
> +++ gcc/loop-invariant.c	2020-11-30 09:56:37.022696142 +0100
> @@ -1099,6 +1099,10 @@ find_invariant_insn (rtx_insn *insn, boo
>    if (HAVE_cc0 && sets_cc0_p (insn))
>      return;
>  
> +  /* Jumps have control flow side-effects.  */
> +  if (JUMP_P (insn))
> +    return;
> +
>    set = single_set (insn);
>    if (!set)
>      return;
> --- gcc/testsuite/gcc.dg/pr97954.c.jj	2020-11-30 10:31:54.870891248 +0100
> +++ gcc/testsuite/gcc.dg/pr97954.c	2020-11-30 10:31:08.875407984 +0100
> @@ -0,0 +1,12 @@
> +/* PR rtl-optimization/97954 */
> +/* { dg-do compile } */
> +/* { dg-options "-O2" } */
> +
> +int
> +foo (void)
> +{
> +  int x;
> + lab:
> +  asm goto ("": "=r" (x) : : : lab);
> +  return x;
> +}
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)

      reply	other threads:[~2020-12-01 10:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01  8:48 Jakub Jelinek
2020-12-01 10:06 ` Richard Biener [this message]

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=nycvar.YFH.7.76.2012011106180.17979@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=law@redhat.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).