public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: James Cowgill <James.Cowgill@imgtec.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] [PR rtl-optimization/65618] Fix MIPS ADA bootstrap failure
Date: Mon, 19 Dec 2016 21:47:00 -0000	[thread overview]
Message-ID: <c053968f-fd0d-ac24-bb86-01f58646c0d3@redhat.com> (raw)
In-Reply-To: <a65ced8f-b0f0-69fb-2fdc-17124296386a@imgtec.com>

On 12/19/2016 08:44 AM, James Cowgill wrote:
> Hi,
>
> This patch fixes PR 65618 where ADA cannot be bootstrapped natively on
> mips due to a bootstrap comparison failure. The PR is currently in the
> target component, but should be in the rtl-optimization component.
>
> The underlying bug is in gcc/emit-rtl.c:try_split and is a result of
> the fix for PR rtl-optimization/48826. In that PR, if a call_insn is
> split into two instructions, the following NOTE_INSN_CALL_ARG_LOCATION
> is moved so that it immediately follows the new call_insn. However,
> after doing that the "after" variable was not updated and it could
> still point to the old note instruction (the instruction after the
> instruction to be split). The "after" variable is later used to obtain
> the last instruction in the split and is then passed back to the
> delayed branch scheduler influencing how delay slots are assigned. My
> patch adjusts the code which handles the NOTE_INSN_CALL_ARG_LOCATION
> note so that "after" is updated if necessary.
>
> This bug causes the ADA bootstrap comparison failure in a-except.o
> because the branch delay scheduling operates slightly differently for
> that file if debug information is turned on.
>
> Thanks,
> James
>
> gcc/Changelog:
>
> 2016-12-16  James Cowgill  <James.Cowgill@imgtec.com>
>
> 	PR rtl-optimization/65618
> 	* emit-rtl.c (try_split): Update "after" when moving a
> 	NOTE_INSN_CALL_ARG_LOCATION.
>
> diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
> index 7de17454037..6be124ac038 100644
> --- a/gcc/emit-rtl.c
> +++ b/gcc/emit-rtl.c
> @@ -3742,6 +3742,11 @@ try_split (rtx pat, rtx_insn *trial, int last)
>  		   next = NEXT_INSN (next))
>  		if (NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
>  		  {
> +		    /* Advance after to the next instruction if it is about to
> +		       be removed.  */
> +		    if (after == next)
> +		      after = NEXT_INSN (after);
> +
>  		    remove_insn (next);
>  		    add_insn_after (next, insn, NULL);
>  		    break;
>
So the thing I don't like when looking at this code is we set AFTER 
immediately upon entry to try_split.  But we don't use it until near the 
very end of try_split.  That's just asking for trouble.

Can we reasonably initialize AFTER just before it's used?

Jeff

  reply	other threads:[~2016-12-19 21:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 15:44 James Cowgill
2016-12-19 21:47 ` Jeff Law [this message]
2016-12-20 14:45   ` James Cowgill
2017-01-01 22:27     ` Jeff Law
2017-01-03 11:04       ` James Cowgill
2017-01-03 18:41         ` Jeff Law
2017-01-11 16:50 ` Maciej W. Rozycki
2017-01-11 17:00   ` James Cowgill
2017-01-11 17:22     ` Maciej W. Rozycki
2017-01-12 11:12       ` James Cowgill

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=c053968f-fd0d-ac24-bb86-01f58646c0d3@redhat.com \
    --to=law@redhat.com \
    --cc=James.Cowgill@imgtec.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).