From: Jeff Law <law@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: Moving backwards/FSM threader into its own pass
Date: Tue, 31 May 2016 15:51:00 -0000 [thread overview]
Message-ID: <d6167395-183c-d2e4-ab96-1eca54359506@redhat.com> (raw)
In-Reply-To: <CAFiYyc0dyxcWAWeuVSgjeER=aUOG5emwz4+cCsEPhU5_DZ-kcA@mail.gmail.com>
On 05/30/2016 03:16 AM, Richard Biener wrote:
>
> Ok, but the placement (and number of) threading passes then no longer depends
> on DOM/VRP passes - and as you placed the threading passes _before_ those
> passes the threading itself does not benefit from DOM/VRP but only from
> previous optimization passes.
Right. Note that number of passes now is actually the same as we had
before, they're just occurring outside DOM/VRP.
The backwards threader's only dependency on DOM/VRP was to propagate
constants into PHI nodes and to propagate away copies. That dependency
was removed.
>
> I see this as opportunity to remove some of them ;) I now see in the main
> optimization pipeline
>
> NEXT_PASS (pass_fre);
> NEXT_PASS (pass_thread_jumps);
> NEXT_PASS (pass_vrp, true /* warn_array_bounds_p */);
>
> position makes sense - FRE removed redundancies and fully copy/constant
> propagated the IL.
>
> NEXT_PASS (pass_sra);
> /* The dom pass will also resolve all __builtin_constant_p calls
> that are still there to 0. This has to be done after some
> propagations have already run, but before some more dead code
> is removed, and this place fits nicely. Remember this when
> trying to move or duplicate pass_dominator somewhere earlier. */
> NEXT_PASS (pass_thread_jumps);
> NEXT_PASS (pass_dominator, true /* may_peel_loop_headers_p */);
>
> this position OTOH doesn't make much sense as IL cleanup is missing
> after SRA and previous opts. After loop we now have
We should look at this one closely. The backwards threader doesn't
depend on IL cleanups. It should do its job regardless of the state of
the IL.
>
> NEXT_PASS (pass_tracer);
> NEXT_PASS (pass_thread_jumps);
> NEXT_PASS (pass_dominator, false /* may_peel_loop_headers_p */);
> NEXT_PASS (pass_strlen);
> NEXT_PASS (pass_thread_jumps);
> NEXT_PASS (pass_vrp, false /* warn_array_bounds_p */);
>
> I don't think we want two threadings so close together. It makes some sense
> to have a threading _after_ DOM but before VRP (DOM cleaned up the IL).
That one is, IMHO, the least useful. I haven't done any significant
analysis of this specific instance though to be sure. The step you saw
was meant to largely preserve behavior. Further cleanups are definitely
possible.
The most common case I've seen where the DOM/VRP make transformations
that then expose something useful to the backward threader come from
those pesky context sensitive equivalences.
We (primarily Andrew, but Aldy and myself are also involved) are looking
at ways to more generally expose range information created for these
situations. Exposing range information and getting it more precise by
allowing "unnecessary copies" or some such would eliminate those cases
where DOM/VRP expose new opportunities for the backwards jump threader.
>
> So that would leave two from your four passes and expose the opportunity
> to re-add one during early-opts, also after FRE. That one should be
> throttled down to operate in "-Os" mode though.
I'll take a look at them, but with some personal stuff and PTO it'll
likely be a few weeks before I've got anything useful.
>
> So, can you see what removing the two threading passes that don't make
> sense to me do to your statistics? And check whether a -Os-like threading
> can be done early?
Interesting you should mention doing threading early -- that was one of
the secondary motivations behind getting the backwards threading bits
out into their own pass, I just failed to mention it.
Essentially we want to limit the backwards substitution to single step
within a single block for that case (which is trivially easy). That
would allow us to run a very cheap threader during early optimizations.
Jeff
next prev parent reply other threads:[~2016-05-31 14:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-27 19:30 Jeff Law
2016-05-30 11:08 ` Richard Biener
2016-05-31 15:51 ` Jeff Law [this message]
2016-05-31 20:42 ` Richard Biener
[not found] ` <2eb35db5-a8bb-84b2-cd46-314cea753498@redhat.com>
2016-06-01 9:46 ` Richard Biener
2016-06-09 11:19 ` Martin Liška
2016-06-09 17:50 ` 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=d6167395-183c-d2e4-ab96-1eca54359506@redhat.com \
--to=law@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--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).