public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@redhat.com>
To: Bernd Schmidt <bernds@codesourcery.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: Resubmit/ping: peephole2 vs cond-exec vs df
Date: Tue, 29 Jun 2010 08:58:00 -0000	[thread overview]
Message-ID: <4C295B32.9070104@redhat.com> (raw)
In-Reply-To: <4C293DB0.8020201@codesourcery.com>

On 06/28/2010 05:26 PM, Bernd Schmidt wrote:
> On 06/29/2010 01:58 AM, Richard Henderson wrote:
>>> +  /* If an insn has RTX_FRAME_RELATED_P set, peephole substitution would lose
>>> +     the REG_FRAME_RELATED_EXPR that is attached.  */
>>> +  if (RTX_FRAME_RELATED_P (insn))
>>> +    {
>>> +      /* Let the buffer drain first.  */
>>> +      if (peep2_current_count > 0)
>>> +	return false;
>>> +      df_simulate_one_insn_forwards (bb, insn, live);
>>> +      return true;
>>
>> You've changed the logic so that frame-related insns are allowed to be
>> peepholed, so long as they begin a match.  Previously we skipped these
>> insns entirely, which I think is more correct.
> 
> I'm not sure this is true.  It never adds a RTX_FRAME_RELATED_P insn to
> the buffer, it just returns true so that we process the next insn?
> 
> I admit the buffer logic is a bit convoluted, and I'd welcome
> suggestions how to make it clearer.  An explicit state machine?

Ah, I missed that we didn't add the insn to the buffer.  I think
all that would be needed is a comment here to that effect.

>> Why do you wait until you've completely filled the buffer before trying
>> a match?  Doesn't this lead to useless work?  Or does this on average
>> pay off because of less calls into peep2_recog (although more calls into
>> df scanning insns)?
> 
> To ensure that we always match the longest possible peephole if there
> are similar ones.

A worthy goal; I hadn't thought of that.  Another comment to add?

> length, but that won't always work if we start to match against
> partially filled buffers.  It's 2am so I may be blind but I don't see
> how it causes more calls into df_simulate or other useless work?  There
> should be exactly one such call per insn as it is added to the buffer
> (plus any updates necessary after we match something and have to
> regenerate life information).  Life information is stored in the buffer
> so we don't have to do anything when advancing the buffer start.

The case in which we have matches is what I had in mind.  Say the
buffer has length 10.  If we fill the buffer then match the first
insn, that invalidates the life information for the entire buffer
does it not?  In which case we've wasted effort on 9 insns.

Unless we deem the peep2 life changes to be strictly local to the
region matched, in which case we can simply re-use the life info
computed the first time around.  I haven't gone back to the patch 
to see if that's what's going on...


r~

  reply	other threads:[~2010-06-29  2:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22 16:36 Bernd Schmidt
2010-06-07 14:46 ` Resubmit/ping: " Bernd Schmidt
2010-06-14 10:17   ` Bernd Schmidt
2010-06-21 14:14     ` Ping^5: " Bernd Schmidt
2010-06-28 12:37       ` Ping^6: " Bernd Schmidt
2010-06-29  4:46   ` Resubmit/ping: " Richard Henderson
2010-06-29  8:34     ` Bernd Schmidt
2010-06-29  8:58       ` Richard Henderson [this message]
2010-06-29 14:31         ` Bernd Schmidt
2010-06-29 18:28           ` Richard Henderson
2010-06-30  2:01           ` Andrew Pinski
2010-06-30  2:03             ` Andrew Pinski
2010-06-30  6:24               ` H.J. Lu
2010-06-30  7:22                 ` H.J. Lu
2010-06-30  8:49                   ` H.J. Lu
2010-06-30 10:15                     ` Bernd Schmidt
2010-06-30 10:52                       ` Richard Guenther
2010-06-30 11:09                         ` Bernd Schmidt
2010-06-30 11:24                           ` Richard Guenther
2010-06-30 11:34                             ` Richard Guenther
2010-06-30 11:52                               ` Bernd Schmidt
2010-06-30 11:52                                 ` Richard Guenther
2010-06-30 11:53                                   ` Bernd Schmidt
2010-06-30 12:10                                     ` Richard Guenther
2010-06-30 16:51                         ` H.J. Lu
2010-07-01  9:26                           ` Bernd Schmidt
2010-06-30  6:10             ` H.J. Lu
2010-06-30  7:46           ` H.J. Lu
2010-06-14 12:28 ` Paolo Bonzini

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=4C295B32.9070104@redhat.com \
    --to=rth@redhat.com \
    --cc=bernds@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).