From: Richard Biener <rguenther@suse.de>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Jakub Jelinek <jakub@redhat.com>,
Jeff Law <jeffreyalaw@gmail.com>,
gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] shrink-wrapping: Don't call can_get_prologue unnecessarily [PR103860]
Date: Mon, 3 Jan 2022 14:16:05 +0100 (CET) [thread overview]
Message-ID: <s4355ps-9qop-2893-3s98-80621p86p919@fhfr.qr> (raw)
In-Reply-To: <20220103131245.GP614@gate.crashing.org>
On Mon, 3 Jan 2022, Segher Boessenkool wrote:
> Hi!
>
> On Mon, Jan 03, 2022 at 12:00:10PM +0100, Jakub Jelinek wrote:
> > On Thu, Dec 30, 2021 at 04:08:25AM -0600, Segher Boessenkool wrote:
> > > > The following simple patch makes sure we call can_get_prologue even after
> > > > the last former iteration when vec is already empty and only break from
> > > > the loop afterwards (and only if the updating of pro done because of
> > > > !can_get_prologue didn't push anything into vec again).
> >
> > During the development of the above patch I've noticed that in many cases
> > we call can_get_prologue often on the same pro again and again and again,
> > we can have many basic blocks pushed into vec and if most of those don't
> > require pro updates, i.e.
> > basic_block bb = vec.pop ();
> > if (!can_dup_for_shrink_wrapping (bb, pro, max_grow_size))
> > while (!dominated_by_p (CDI_DOMINATORS, bb, pro))
> > isn't true, then pro is can_get_prologue checked for each bb in the vec.
> >
> > The following simple patch just remembers which bb we've verified already
> > and verifies again only when pro changes. Most of the patch is just
> > reindentation.
>
> I'd like it better if the code structure was changed so you do not need
> this workaround. That will probably result in much clearer code.
>
> But it does look correct :-)
>
> This should make things O(n) again here. Thanks for fixing this!
Btw, you can take that as approval.
Richard.
prev parent reply other threads:[~2022-01-03 13:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-30 9:43 [PATCH] shrink-wrapping: Fix up prologue block discovery [PR103860] Jakub Jelinek
2021-12-30 10:08 ` Segher Boessenkool
2021-12-30 12:52 ` Jeff Law
2022-01-03 11:00 ` [PATCH] shrink-wrapping: Don't call can_get_prologue unnecessarily [PR103860] Jakub Jelinek
2022-01-03 13:12 ` Segher Boessenkool
2022-01-03 13:16 ` Richard Biener [this message]
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=s4355ps-9qop-2893-3s98-80621p86p919@fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jeffreyalaw@gmail.com \
--cc=segher@kernel.crashing.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).