public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix up maybe_cleanup_end_of_block (PR middle-end/46499)
Date: Wed, 24 Nov 2010 01:51:00 -0000	[thread overview]
Message-ID: <AANLkTi=0TLuQsPeHJ-ZHKFf2iHfYiRnQFq9xn9nFGNeM@mail.gmail.com> (raw)
In-Reply-To: <20101122220027.GR29412@tyan-ft48-01.lab.bos.redhat.com>

On Mon, Nov 22, 2010 at 2:00 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> On the attached testcases jumpif* emits:
>   (jump_insn 8 7 9 (set (pc)
>           (label_ref 0)) pr46499-1.c:26 -1
>        (nil))
>
>   (barrier 9 8 10)
>
>   (jump_insn 10 9 11 (set (pc)
>           (label_ref 0)) pr46499-1.c:26 -1
>        (nil))
>
>   (barrier 11 10 0)
> where the label_ref in both cases is the non-fallthru label.  This is
> because ssa_name & ssa_name is the condition and both ssa_name's
> are found using TER to be 0 (and the -fno-* options ensure it is not
> optimized earlier).
> maybe_cleanup_end_of_block is called to find out when the sequence ends
> with an unconditional jump to the non-fallthru label, with no fallthru
> code_label afterwards, which means all the sequence does (assuming no
> side-effects in it but GIMPLE should ensure that) is that unconditional
> jump and attempts to remove any other jumps from the sequence.
> Apparently it was expecting just conditional jumps to the non-fallthru
> label, for unconditional ones as in this example the following
> barrier needs to be removed too, otherwise we end up with a barrier
> in a middle of a bb and we either ICE on it, or miscompile it.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2010-11-22  Jakub Jelinek  <jakub@redhat.com>
>
>        PR middle-end/46499
>        * cfgexpand.c (maybe_cleanup_end_of_block): Remove also BARRIERs
>        following unconditional jumps.
>
>        * gcc.dg/pr46499-1.c: New test.
>        * gcc.dg/pr46499-2.c: New test.
>
> --- gcc/cfgexpand.c.jj  2010-11-10 13:14:53.000000000 +0100
> +++ gcc/cfgexpand.c     2010-11-22 14:45:49.000000000 +0100
> @@ -1694,7 +1694,14 @@ maybe_cleanup_end_of_block (edge e, rtx
>        {
>          insn = PREV_INSN (insn);
>          if (JUMP_P (NEXT_INSN (insn)))
> -           delete_insn (NEXT_INSN (insn));
> +           {
> +             if (!any_condjump_p (insn))
                                                 ^^^^^^ Shouldn't it
be any_condjump_p (NEXT_INSN (insn))
> +               {
> +                 gcc_assert (BARRIER_P (NEXT_INSN (NEXT_INSN (insn))));
> +                 delete_insn (NEXT_INSN (NEXT_INSN (insn)));
> +               }
> +             delete_insn (NEXT_INSN (insn));
> +           }
>        }
>     }
>  }


-- 
H.J.

  parent reply	other threads:[~2010-11-24  0:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-22 23:18 Jakub Jelinek
2010-11-23 13:27 ` Richard Guenther
2010-11-23 22:51 ` H.J. Lu
2010-11-23 22:54   ` H.J. Lu
2010-11-23 22:55     ` Andrew Pinski
2010-11-24  1:51 ` H.J. Lu [this message]
2010-11-24  2:37   ` Jakub Jelinek
2010-11-24  2:44     ` H.J. Lu
2010-11-24 10:04   ` [PATCH] Fix up maybe_cleanup_end_of_block (PR middle-end/46629) Jakub Jelinek
2010-11-24 11:13     ` [testcase] " Jakub Jelinek
2010-11-24 11:30       ` Richard Guenther
2010-11-24 11:48         ` Jakub Jelinek

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='AANLkTi=0TLuQsPeHJ-ZHKFf2iHfYiRnQFq9xn9nFGNeM@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@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).