public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Jeff Law <jeffreyalaw@gmail.com>,
	GCC patches <gcc-patches@gcc.gnu.org>,
	 Andrew MacLeod <amacleod@redhat.com>
Subject: Re: [RFC] Remove VRP threader passes in exchange for better threading pre-VRP.
Date: Tue, 19 Oct 2021 11:16:51 +0200	[thread overview]
Message-ID: <CAGm3qMUh79qpyyQuiiZtO1EfAu0tJOgpaJycgayJVskNWE=0AA@mail.gmail.com> (raw)
In-Reply-To: <fee69040-f1fe-5167-cd30-35393ce43012@redhat.com>

On Tue, Oct 19, 2021 at 11:06 AM Aldy Hernandez <aldyh@redhat.com> wrote:
>
>
>
> On 10/19/21 10:40 AM, Richard Biener wrote:
> > On Tue, Oct 19, 2021 at 9:33 AM Aldy Hernandez <aldyh@redhat.com> wrote:
> >>
> >> On Tue, Oct 19, 2021 at 8:52 AM Richard Biener
> >> <richard.guenther@gmail.com> wrote:
> >>>
> >>> On Mon, Oct 18, 2021 at 4:03 PM Aldy Hernandez <aldyh@redhat.com> wrote:
> >>>>
> >>>>
> >>>>
> >>>> On 10/18/21 3:41 PM, Aldy Hernandez wrote:
> >>>>
> >>>>> I've been experimenting with reducing the total number of threading
> >>>>> passes, and I'd like to see if there's consensus/stomach for altering
> >>>>> the pipeline.  Note, that the goal is to remove forward threader clients,
> >>>>> not the other way around.  So, we should prefer to remove a VRP threader
> >>>>> instance over a *.thread one immediately before VRP.
> >>>>>
> >>>>> After some playing, it looks like if we enable fully-resolving mode in
> >>>>> the *.thread passes immediately preceeding VRP, we can remove the VRP
> >>>>> threading passes altogether, thus removing 2 threading passes (and
> >>>>> forward threading passes at that!).
> >>>>
> >>>> It occurs to me that we could also remove the threading before VRP
> >>>> passes, and enable a fully-resolving backward threader after VRP.  I
> >>>> haven't played with this scenario, but it should be just as good.  That
> >>>> being said, I don't know the intricacies of why we had both pre and post
> >>>> VRP threading passes, and if one is ideally better than the other.
> >>>
> >>> It was done because they were different threaders.  Since the new threader
> >>> uses built-in VRP it shouldn't really matter whether it's before or after
> >>> VRP _for the threading_, but it might be that if threading runs before VRP
> >>> then VRP itself can do a better job on cleaning up the IL.
> >>
> >> Good point.
> >>
> >> FWIW, earlier this season I played with replacing the VRPs with evrp
> >> instances (which fold far more conditionals) and I found that the
> >> threaders can actually find LESS opportunities after *vrp fold away
> >> things.  I don't know if this is a good or a bad thing.
> >
> > Probably a sign that either threading theads stuff that's pointless
> > (does not consider conditions on the path that always evaluate false?)
>
> At least in the backward threader, we don't keep looking back if we can
> resolve the conditional at the end of an in-progress path, so it's
> certainly possible we thread paths that are unreachable.  I'm pretty
> sure that's also possible in the forward threader.
>
> For example, we if we have a candidate path that ends in x > 1234 and we
> know on entry to the path that x is [2000,3000], there's no need to
> chase further back to see if the path itself is reachable.

For that matter, when I was working on replacing the DOM threader, I
found out that the forward threader + evrp routinely tried to thread
paths that were unreachable, and I had to trim them from my comparison
tally.  The new backward threader engine suffers less from this,
because if there is an UNDEFINED range as part of the in-path
calculation, we can trim the path as unreachable (and avoid further
searches in that direction).  However, as I said, if the range is
known on entry, we do no further lookups and happily thread away.

Aldy


  reply	other threads:[~2021-10-19  9:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18 13:41 Aldy Hernandez
2021-10-18 14:03 ` Aldy Hernandez
2021-10-19  6:52   ` Richard Biener
2021-10-19  7:33     ` Aldy Hernandez
2021-10-19  8:40       ` Richard Biener
2021-10-19  9:06         ` Aldy Hernandez
2021-10-19  9:16           ` Aldy Hernandez [this message]
2021-10-19 23:06       ` Jeff Law
2021-10-19 23:00   ` Jeff Law
2021-10-20  9:27     ` Aldy Hernandez
2021-10-20 12:32       ` Andrew MacLeod
2021-10-20 13:08         ` Aldy Hernandez
2021-10-20 17:55       ` Jeff Law
2021-10-19 22:58 ` Jeff Law

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='CAGm3qMUh79qpyyQuiiZtO1EfAu0tJOgpaJycgayJVskNWE=0AA@mail.gmail.com' \
    --to=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=richard.guenther@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).