From: Jeff Law <jeffreyalaw@gmail.com>
To: Aldy Hernandez <aldyh@redhat.com>, Michael Matz <matz@suse.de>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: More aggressive threading causing loop-interchange-9.c regression
Date: Fri, 10 Sep 2021 10:31:42 -0600 [thread overview]
Message-ID: <78b49eb7-0039-9d3d-e459-8da8beaa7175@gmail.com> (raw)
In-Reply-To: <8998611b-c229-e1d2-9a7a-770f6d45e582@redhat.com>
On 9/10/2021 7:53 AM, Aldy Hernandez via Gcc-patches wrote:
>
>
> On 9/10/21 3:16 PM, Michael Matz wrote:
>> Hi,
>>
>> On Fri, 10 Sep 2021, Aldy Hernandez via Gcc-patches wrote:
>>
>>> }
>>> +
>>> + /* Threading through a non-empty latch would cause code to be added
>>
>> "through an *empty* latch". The test in code is correct, though.
>
> Whoops.
>
>>
>> And for the before/after loops flag you added: we have a
>> cfun->curr_properties field which can be used. We even already have a
>> PROP_loops flag but that is set throughout compilation from CFG
>> construction until the RTL loop optimizers, so can't be re-used for what
>> is needed here. But you still could invent another PROP_ value
>> instead of
>> adding a new field in struct function.
>
> Oooo, even better. No inline functions.
>
> Like this?
> Aldy
>
> 0001-Disable-threading-through-latches-until-after-loop-o.patch
>
> From ff25faa8dd8721da9bb4715706c662fc09fd4e8c Mon Sep 17 00:00:00 2001
> From: Aldy Hernandez <aldyh@redhat.com>
> Date: Thu, 9 Sep 2021 20:30:28 +0200
> Subject: [PATCH] Disable threading through latches until after loop
> optimizations.
>
> The motivation for this patch was enabling the use of global ranges in
> the path solver, but this caused certain properties of loops being
> destroyed which made subsequent loop optimizations to fail.
> Consequently, this patch's mail goal is to disable jump threading
> involving the latch until after loop optimizations have run.
>
> As can be seen in the test adjustments, we mostly shift the threading
> from the early threaders (ethread, thread[12] to the late threaders
> thread[34]). I have nuked some of the early notes in the testcases
> that came as part of the jump threader rewrite. They're mostly noise
> now.
>
> Note that we could probably relax some other restrictions in
> profitable_path_p when loop optimizations have completed, but it would
> require more testing, and I'm hesitant to touch more things than needed
> at this point. I have added a reminder to the function to keep this
> in mind.
>
> Finally, perhaps as a follow-up, we should apply the same restrictions to
> the forward threader. At some point I'd like to combine the cost models.
>
> Tested on x86-64 Linux.
>
> p.s. There is a thorough discussion involving the limitations of jump
> threading involving loops here:
>
> https://gcc.gnu.org/pipermail/gcc/2021-September/237247.html
>
> gcc/ChangeLog:
>
> * tree-pass.h (PROP_loop_opts_done): New.
> * gimple-range-path.cc (path_range_query::internal_range_of_expr):
> Intersect with global range.
> * tree-ssa-loop.c (tree_ssa_loop_done): Set PROP_loop_opts_done.
> * tree-ssa-threadbackward.c
> (back_threader_profitability::profitable_path_p): Disable
> threading through latches until after loop optimizations have run.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.dg/tree-ssa/ssa-dom-thread-2b.c: Adjust for disabling of
> threading through latches.
> * gcc.dg/tree-ssa/ssa-dom-thread-6.c: Same.
> * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Same.
OK
jeff
next prev parent reply other threads:[~2021-09-10 16:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <09e48b82-bc51-405e-7680-89a5f08e4e8f@redhat.com>
[not found] ` <alpine.LSU.2.20.2109071406070.12583@wotan.suse.de>
[not found] ` <cb4191f1-0432-8740-b327-078c2aaff0fa@redhat.com>
[not found] ` <CAFiYyc3ZBApnN3ks3YExLTLQ8tvEdFV-uuU2MXVVqXFYn+cdRw@mail.gmail.com>
[not found] ` <d8234eed-6c60-c5fb-8800-5e9c5b932c58@redhat.com>
[not found] ` <CAFiYyc2KWNEMD31AdYuNJ-dP7ixMsWtTCtokQpcbRrZctTUqzA@mail.gmail.com>
[not found] ` <6d5695e4-e4eb-14a5-46a6-f425d1514008@redhat.com>
[not found] ` <alpine.LSU.2.20.2109081627081.12583@wotan.suse.de>
[not found] ` <alpine.LSU.2.20.2109081736530.12583@wotan.suse.de>
[not found] ` <56bd6a6c-0416-7123-c792-521495d69654@redhat.com>
[not found] ` <alpine.LSU.2.20.2109091249420.12583@wotan.suse.de>
[not found] ` <7dad1f1f-98e3-f6c7-8cbd-d01122b72260@redhat.com>
[not found] ` <alpine.LSU.2.20.2109091342460.12583@wotan.suse.de>
2021-09-10 7:04 ` Aldy Hernandez
2021-09-10 13:16 ` Michael Matz
2021-09-10 13:53 ` Aldy Hernandez
2021-09-10 14:33 ` Michael Matz
2021-09-10 16:31 ` Jeff Law [this message]
2021-09-13 11:48 ` Christophe Lyon
2021-09-13 13:04 ` Aldy Hernandez
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=78b49eb7-0039-9d3d-e459-8da8beaa7175@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=aldyh@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=matz@suse.de \
/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).