public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Wilco Dijkstra" <wdijkstr@arm.com>
To: "'Jeff Law'" <law@redhat.com>,	<gcc-patches@gcc.gnu.org>
Subject: RE: [PATCH] Fix IRA register preferencing
Date: Wed, 10 Dec 2014 13:26:00 -0000	[thread overview]
Message-ID: <000c01d0147c$dff88210$9fe98630$@com> (raw)
In-Reply-To: <54878309.6070408@redhat.com>

> Jeff Law wrote:
> On 12/09/14 12:21, Wilco Dijkstra wrote:
> > With the fix it uses a floating point register as expected. Given a similar issue in
> > https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02253.html, would it not be better to change
> the
> > initialization values of reg_pref to illegal register classes so this kind of issue can be
> trivially
> > found with an assert? Also would it not be a good idea to have a single register copy
> function that
> > ensures all data is copied?
> But there are other times when you really don't want to copy, say when
> the original had a small class, but the copy can go into a larger class.
> 
> I banged my head on this when I was doing similar work on range
> splitting a few years back and ended up recomputing the preferred and
> alternate class information.  That was much better than copying the
> classes.

If recomputing is best does that mean that record_reg_classes should not
give a boost to the preferred class in the 2nd pass? I don't understand
what purpose this has - if the preferred class is from the first pass, it
is already correct, so all it does is boost the preferred class further. 
And if the preferred class is wrong (eg. after live range splitting), it 
will boost the incorrect class even harder, so in the end you never get 
a different class.

> I pondered heuristics to expand the preferred class, but never
> implemented anything IIRC.  A trivial heuristic would be to bump to the
> next larger class if the given class was a singleton, otherwise copy the
> class.
> 
> The obvious counter to that heuristic is an allocno that has two ranges
> (or N ranges) where we would prefer a different singleton class for each
> range.  In fact, I'm pretty sure I ran into this kind of situation and
> that led me down the "just recompute it" path.
> 
> I'd hazard a guess that the simple heuristic would do better than what
> we're doing now with GENERAL_REGS though or what you're doing with copying.

From what you're saying, recomputing seems best, and I'd be happy to submit
a patch to remove all the preferred class code from record_reg_classes.

However there is still the possibility the preferred class is queried before
the recomputation happens (I think that is a case Renlin fixed). Either these
should be faulted and fixed by forcing recomputation, or we need to provide a 
correct preferred class. That should be a copy of the original class.

Wilco



  reply	other threads:[~2014-12-10 13:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-09 19:21 Wilco Dijkstra
2014-12-09 23:17 ` Jeff Law
2014-12-10 13:26   ` Wilco Dijkstra [this message]
2014-12-10 20:47     ` Jeff Law
2015-04-27 15:01       ` Wilco Dijkstra
2015-11-10 13:31 Wilco Dijkstra
2015-11-12  3:44 ` Vladimir Makarov

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='000c01d0147c$dff88210$9fe98630$@com' \
    --to=wdijkstr@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --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).