From: Jakub Jelinek <jakub@redhat.com>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] Don't update_cfg_for_uncondjump for noop non-jump moves
Date: Tue, 12 Apr 2011 17:09:00 -0000 [thread overview]
Message-ID: <20110412170826.GG17079@tyan-ft48-01.lab.bos.redhat.com> (raw)
In-Reply-To: <201104120918.01366.ebotcazou@adacore.com>
On Tue, Apr 12, 2011 at 09:18:01AM +0200, Eric Botcazou wrote:
> > The propagate_for_debug change alone could fix it, we should never
> > fall through into next basic block. We are unforuntately not deleting
> > just jumps (which ought to appear at the end of bbs), but also
> > any other noop moves, which I think is unintentional, we have
> > delete_noop_moves that should clean that up instead (see the second patch).
>
> Yes, I wondered several times about that. This clearly looks unintentional and
> I agree that it is worth fixing on the mainline, adding gcc_assert (at_end); to
> update_cfg_for_uncondjump in the process.
Here is a patch, bootstrapped/regtested on x86_64-linux and i686-linux.
Ok for trunk?
2011-04-12 Jakub Jelinek <jakub@redhat.com>
* combine.c (update_cfg_for_uncondjump): Instead of testing at_end
assert it is always true.
(try_combine): Don't call update_cfg_for_uncondjump for noop non-jump
moves.
--- gcc/combine.c.jj 2011-04-12 12:52:11.963669819 +0200
+++ gcc/combine.c 2011-04-12 16:31:57.059671430 +0200
@@ -2490,13 +2490,12 @@ static void
update_cfg_for_uncondjump (rtx insn)
{
basic_block bb = BLOCK_FOR_INSN (insn);
- bool at_end = (BB_END (bb) == insn);
+ gcc_assert (BB_END (bb) == insn);
- if (at_end)
- purge_dead_edges (bb);
+ purge_dead_edges (bb);
delete_insn (insn);
- if (at_end && EDGE_COUNT (bb->succs) == 1)
+ if (EDGE_COUNT (bb->succs) == 1)
{
rtx insn;
@@ -4409,7 +4408,8 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx
/* A noop might also need cleaning up of CFG, if it comes from the
simplification of a jump. */
- if (GET_CODE (newpat) == SET
+ if (JUMP_P (i3)
+ && GET_CODE (newpat) == SET
&& SET_SRC (newpat) == pc_rtx
&& SET_DEST (newpat) == pc_rtx)
{
@@ -4418,6 +4418,7 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx
}
if (undobuf.other_insn != NULL_RTX
+ && JUMP_P (undobuf.other_insn)
&& GET_CODE (PATTERN (undobuf.other_insn)) == SET
&& SET_SRC (PATTERN (undobuf.other_insn)) == pc_rtx
&& SET_DEST (PATTERN (undobuf.other_insn)) == pc_rtx)
Jakub
next prev parent reply other threads:[~2011-04-12 17:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-11 10:50 [PATCH] Fix combiner ICEs after my recent patch (PR rtl-optimization/48549) Jakub Jelinek
2011-04-12 7:23 ` Eric Botcazou
2011-04-12 8:07 ` Jakub Jelinek
2011-04-12 8:35 ` Eric Botcazou
2011-04-12 10:55 ` Jakub Jelinek
2011-04-12 17:09 ` Jakub Jelinek [this message]
2011-04-12 17:12 ` [PATCH] Don't update_cfg_for_uncondjump for noop non-jump moves Jeff Law
2011-04-12 17:31 ` Eric Botcazou
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=20110412170826.GG17079@tyan-ft48-01.lab.bos.redhat.com \
--to=jakub@redhat.com \
--cc=ebotcazou@adacore.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).