public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Segher Boessenkool <segher@kernel.crashing.org>, gcc-patches@gcc.gnu.org
Cc: bonzini@gnu.org, seongbae.park@gmail.com, zadeck@naturalbridge.com
Subject: Re: [PATCH] df: Keep return address register undefined until epilogue_completed
Date: Fri, 09 Sep 2016 22:42:00 -0000	[thread overview]
Message-ID: <4b577e76-bcb7-9fd2-e77f-41a6358b7e4c@redhat.com> (raw)
In-Reply-To: <c6b7f1d6bfb232511d9e0a3467bd87db65e27b6b.1472488939.git.segher@kernel.crashing.org>

On 08/29/2016 10:50 AM, Segher Boessenkool wrote:
> For separate shrink-wrapping we need to find out which basic blocks
> need what components set up by a prologue, so that we can move those
> prologue pieces deeper into the function, so that those pieces are
> executed less frequently, improving performance.
>
> To do this, target code will normally look at the LIVE info: a block
> needs a register set up if that register is in the IN, GEN, or KILL
> sets.  This works fine for the callee-saved registers, since those
> are not in entry_block_defs, but it does not work for the rs6000 link
> register, because df_get_entry_block_def_set unconditinally adds the
> register that is INCOMING_RETURN_ADDR_RTX (if it is a register).
>
> This patch changes that so that that def is only added after
> epilogue_completed.
>
> With that, in the rs6000 backend we can use the same IN+GEN+KILL
> condition to see whether LR is used (in the current patch set, only
> KILL is used, which isn't correct; the backend can write to LR to
> temporarily hold other values; a crazy idea, on modern hardware anyway,
> but it does regardless).
>
> Does this work on all other targets?  Should anything else be done?
>
>
> Segher
>
>
> 2016-08-29  Segher Boessenkool  <segher@kernel.crashing.org>
>
> 	* df-scan.c (df_get_entry_block_def_set): Do not add the
> 	INCOMING_RETURN_ADDR_RTX register until epilogue_completed.
Right now the dataflow is conservatively correct WRT the return register.

If we made the change you want to make than the dataflow becomes overly 
optimistic about the range over which the return register is live prior 
to inserting the prologue/epilogue into the insn chain.

This seems unsafe to me.
jeff



  parent reply	other threads:[~2016-09-09 22:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29 16:50 Segher Boessenkool
2016-08-29 20:20 ` Steven Bosscher
2016-08-29 20:41   ` Segher Boessenkool
2016-09-09 22:51     ` Jeff Law
2016-09-09 22:35   ` Jeff Law
2016-09-09 22:42 ` Jeff Law [this message]
2016-09-10  8:03   ` Segher Boessenkool
2016-09-12 16:33     ` Jeff Law
2016-09-14 12:46       ` Segher Boessenkool

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=4b577e76-bcb7-9fd2-e77f-41a6358b7e4c@redhat.com \
    --to=law@redhat.com \
    --cc=bonzini@gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    --cc=seongbae.park@gmail.com \
    --cc=zadeck@naturalbridge.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).