public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: rsandifo@nildram.co.uk (Richard Sandiford)
Cc: ebotcazou@libertysurf.fr (Eric Botcazou), gcc-patches@gcc.gnu.org
Subject: Re: [4.2 only] RFA: PR 33848: reload rematerialisation of labels
Date: Mon, 12 Nov 2007 21:48:00 -0000	[thread overview]
Message-ID: <200711122039.lACKdRfU008173@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <87y7dlpp2d.fsf@firetop.home> from "Richard Sandiford" at Oct 29, 2007 09:51:22 PM

Richard Sandiford wrote:
> Eric Botcazou <ebotcazou@libertysurf.fr> writes:
> > Sorry, I don't seem to be able to make up my mind about this affair or
> > clearly formulate what I'm afraid of.  The thing is, it's reload and
> > I'll never feel comfortable with patching it on a release branch.  So
> > I'd suggest to run this by some other maintainer (RTH?), setting aside
> > the current thread.
> 
> Understood, thanks.  I'll probably wait a few days to see if anyone
> volunteers before I pick a victim.

Richard asked me to have at look at this issue.  Unfortunately, I don't
see any real solution either (except back-porting the full H-P patch).

Looking at the problem from the perspective of finding the most
conservative change, I can see a number of things we should clearly
*not* do:

- Change a non-NULL JUMP_LABEL to something else.
  (Reload must never actually change control flow.)

- Create a jump_insn with REG_LABEL but NULL JUMP_LABEL.
  (This is inconsistent, as Richard points out.)

- More generally, create an insn that a future run of
  rebuild_jump_labels would modify.

But we also should not simply remove an explicit reference to
a label *without* adding a REG_LABEL note, as this could screw
up reference counting on the label and potentially cause it to
be deleted (even though it is still referenced) -- e.g. if the
label has been pushed into the literal pool.


So, ideally, I think we should add the REG_LABEL note and then
recompute the JUMP_LABEL field just like a future run of
rebuild_jump_labels would do.

Now, what value would a future run of rebuild_jump_label create?
Either the label we just added as REG_LABEL, or some other label
(certainly never NULL).  The only reason we might get some other
label is if that label is already mentioned in the insn.  In that
case, we should have already seen a non-NULL JUMP_LABEL prior to 
reload, and reload should not change it.

(However, in the situation where we have a label in the insn that
we are replacing, we should in fact *never* have a non-NULL
JUMP_LABEL -- but apparently we do sometimes ...)


Getting back to the question of what the most conservative fix
for the branch would be, I therefore think it should be something
along the lines of:
- continue to always add the REG_LABEL if we replace a label
- continue to change a NULL JUMP_LABEL to the replaced label
- do *not* change any pre-existing non-NULL JUMP_LABEL

This change should fix the regression in 33848, and it should not
make any other case worse -- it will only change the behaviour of
reload in cases are are obviously broken today ...

Any comments?   Am I overlooking something here?

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com

  parent reply	other threads:[~2007-11-12 20:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-23 18:46 Richard Sandiford
2007-10-26 20:44 ` Eric Botcazou
2007-10-27 10:51   ` Richard Sandiford
2007-10-27 11:01     ` Eric Botcazou
2007-10-27 11:02       ` Richard Sandiford
2007-10-27 11:38         ` Eric Botcazou
2007-10-27 11:43           ` Richard Sandiford
2007-10-27 12:05             ` Eric Botcazou
2007-10-27 12:47               ` Richard Sandiford
2007-10-27 14:19                 ` Eric Botcazou
2007-10-27 14:28                   ` Richard Sandiford
2007-10-28 12:04                     ` Richard Sandiford
2007-10-29 13:41                     ` Eric Botcazou
2007-10-29 21:56                       ` Richard Sandiford
2007-10-29 22:42                         ` Eric Botcazou
2007-11-04 23:57                         ` Mark Mitchell
2007-11-12 20:38                           ` Richard Sandiford
2007-11-12 21:48                         ` Ulrich Weigand [this message]
2007-11-12 22:13                           ` Richard Sandiford
2007-11-13 23:09                             ` Ulrich Weigand
2007-11-13 23:31                               ` Richard Sandiford
2007-11-14  4:13                                 ` Ulrich Weigand
2007-11-21 10:07                                   ` Richard Sandiford
2007-11-22 10:55                                     ` Ulrich Weigand
2007-11-23 10:32                                       ` Richard Sandiford
2007-11-23 10:41                                       ` Richard Sandiford

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=200711122039.lACKdRfU008173@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=ebotcazou@libertysurf.fr \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rsandifo@nildram.co.uk \
    /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).