public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Bernd Schmidt <bschmidt@redhat.com>,
	       GCC Patches <gcc-patches@gcc.gnu.org>,
	       Vladimir Makarov <vmakarov@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>
Subject: Re: LRA remat issue with hard regs (PR70123)
Date: Fri, 11 Mar 2016 22:38:00 -0000	[thread overview]
Message-ID: <56E348E7.1000404@redhat.com> (raw)
In-Reply-To: <56E1B8B0.4030105@redhat.com>

On 03/10/2016 11:10 AM, Bernd Schmidt wrote:
> When I submitted my previous lra-remat patch, I mentioned I had some
> concerns about the way we dealt with register number comparisons, but I
> didn't want to change things blindly without a testcase. PR70123 has now
> provided such a testcase where we are trying to rematerialize a hard
> register (r6). While scanning we encounter an instruction of the form
>   (set (reg 285) (reg 272))
> i.e. involving only pseudos, but reg_renumber[285] is r6. Since we only
> compare register numbers, we do not notice that the hard reg is clobbered.
>
> The following patch modifies the function input_regno_present_p, and
> also renames it so that its purpose is more obvious to someone familiar
> with other parts of gcc. I've made it look at reg_renumber, and also try
> to deal with multi-word hard registers properly.
>
> I'm not entirely sure this is a fully safe approach however, since I
> can't yet answer the question of whether LRA could change another pseudo
> to reside in hard register 6, thereby making the rematerialization
> invalid after the fact. Therefore the patch also includes a change to
> just disable candidates if they involve hard registers. I haven't
> observed that making any difference in code generation (on x86_64),
> beyond fixing the testcase on s390.
>
> Bootstrapped and tested on x86_64-linux; Jakub verified that the
> testcase works afterwards. Ok for trunk and 5-branch, either for one or
> for both parts? I'm hoping the testcase in gcc.dg/torture will get
> exercised in the right way on s390, but I haven't run tests on that
> machine.
>
>
> Bernd
>
> remat-hardregs.diff
>
>
> 	PR target/70123
> 	* lra-remat.c (operand_to_remat): Disallow hard regs in the value t
> 	be rematerialized.
> 	(reg_overlap_for_remat_p): Renamed from input_regno_present_p.
> 	Arguments swapped.  All callers changed.  Take reg_renumber into
> 	account, and Calculate and compare register ranges for hard regs.
>
> 	PR target/70123
> 	* gcc.dg/torture/pr70123.c: New test.
I went ahead and committed this to the trunk to give it soak time over 
the weekend.

jeff

      parent reply	other threads:[~2016-03-11 22:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <56E1B422.6020000@t-online.de>
2016-03-10 18:11 ` Bernd Schmidt
2016-03-11 21:56   ` Jeff Law
2016-03-11 22:38   ` Jeff Law [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=56E348E7.1000404@redhat.com \
    --to=law@redhat.com \
    --cc=bschmidt@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=vmakarov@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).