public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@adacore.com>
To: Steven Bosscher <stevenb.gcc@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [RFC] Fix spill failure at -O on 64-bit Windows
Date: Wed, 17 Oct 2012 15:38:00 -0000	[thread overview]
Message-ID: <4130798.kqQ8B4cVbj@polaris> (raw)
In-Reply-To: <CABu31nPYQsKKbGuseDvCh8=_8sXaBsukbaVp7mTBLAc9p1VYFw@mail.gmail.com>

> I don't understand what you mean with extending the life of the hard
> register in this case. If you move the clobber with the instruction,
> the hard reg is dead before the clobber and after the insn that uses
> it, just like when the insn is not hoisted from the loop. So you don't
> extend the reg's live range if you move the clobber with it. And if
> the register is not dead after the insn, it must be live through the
> loop (otherwise it would be only partially available on the loop
> entry, coming in from the loop latch) so you don't extend the live
> range in that case either.

In the former case, I agree that you don't really extend the live range.
But you nevertheless extend its "span", i.e. you create a live range for the 
hard register out of the loop, while it's supposed to be used only just before 
the call in the argument preparation.  In the latter case, I'm not sure that 
your conclusion holds: why can't it be used in a second insn and die there?

> (One thing I don't fully understand here, though, is why the clobber
> doesn't prevent the code motion to begin with. If you don't move the
> clobber, that could change the semantics of the program, right? E.g if
> you have before LIM something like this:
> 
>   while (some_condition) { clobber(ecx); invariant_use (ecx);  ... };
>   use (ecx);
> 
> and after LIM you have:
> 
>   invariant_use (ecx);
>   while (some_condition) { clobber(ecx);  ... };
>   use (ecx);
> 
> that's not the same program anymore if some_condition isn't true...
> Not sure if that matters for this kind of uninitialized use.)

I agree that moving an uninitialized use (of a hard register) without moving 
the associated clobber is weird.  But I think most RTL passes don't care and 
this probably doesn't affect the correctness of the generated code.

> I've got a great dislike for special cases in the GCC code base, they
> tend to grow into common practice at alarmingly fast rates :-)
> But I suppose your point of view is more pragmatic in this peculiar case.

I'm just realistic: you don't want to make substantial changes in a powerful 
optimization pass just because of a corner case in an exotic language on a 
semi-exotic platform. :-)

-- 
Eric Botcazou

      reply	other threads:[~2012-10-17 14:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-15 18:10 Eric Botcazou
2012-10-15 18:12 ` Steven Bosscher
2012-10-17 10:07   ` Eric Botcazou
2012-10-17 12:02     ` Steven Bosscher
2012-10-17 15:38       ` Eric Botcazou [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=4130798.kqQ8B4cVbj@polaris \
    --to=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=stevenb.gcc@gmail.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).