public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Oleg Endo <oleg.endo@t-online.de>
Cc: Stefan Franke <stefan@franke.ms>, gcc-help@gcc.gnu.org
Subject: Re: Additional peephole pass(es)
Date: Fri, 24 Apr 2020 16:36:30 -0500	[thread overview]
Message-ID: <20200424213630.GD26902@gate.crashing.org> (raw)
In-Reply-To: <483f01539801e24cc268be2c0adba34ada3a5e7a.camel@t-online.de>

Hi!

On Tue, Apr 21, 2020 at 02:34:09AM +0900, Oleg Endo wrote:
> Yeah, it's true, combine doesn't catch every possible combination and
> the canonical form is also sometimes questionable.

Yeah.  Bug reports welcome!

This isn't "canonical" usually; but all targets depend more or less on
what insns combine used to generate.  Even for comparably tiny changes
(that are a net good thing for all targets!) people become very unhappy
already, so yeah it is some kinf of "de facto" canonical: but it is not
that we promised this is the form we would use, and it is not that we
think this is the best and we should not change it; the problem just is
inertia.

> You can add
> additional passes in the backend as you like.  If a particular
> additional pass for a particular backend results in significant
> improvements in code quality or such, then why not?
> 
> You can also do "manual combine" of certain insns in the split1 pass
> that runs after combine.  For some examples you can browse through the
> SH backend.

In combine itself runs split as well (one insn to two).  And you can
add instruction patterns to your machine description that are only there
for combine: you split them to separate insns immediately again (maybe
this is what you meant though?)

> The problem with peepholes is that they tend to break easily because
> they depend on insn order.  If something else in the compiler decides
> to insert insns between two related insns, peephole patterns usually
> break.

Another big problem is that it is very, very hard to write a *correct*
(non-trivial) peephole2.


Segher

  reply	other threads:[~2020-04-24 21:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20 10:20 Stefan Franke
2020-04-20 17:34 ` Oleg Endo
2020-04-24 21:36   ` Segher Boessenkool [this message]
2020-04-25  4:04     ` Oleg Endo
2020-04-25 12:21       ` Segher Boessenkool
2020-04-24 21:07 ` 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=20200424213630.GD26902@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-help@gcc.gnu.org \
    --cc=oleg.endo@t-online.de \
    --cc=stefan@franke.ms \
    /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).