From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Optimize in VRP loads from constant arrays (take 2)
Date: Wed, 03 May 2017 08:10:00 -0000 [thread overview]
Message-ID: <20170503080359.GJ1809@tucnak> (raw)
In-Reply-To: <alpine.LSU.2.20.1705021444590.17885@zhemvz.fhfr.qr>
On Tue, May 02, 2017 at 02:50:16PM +0200, Richard Biener wrote:
> > If array_at_struct_end_p is wrong, it should be fixed ;)
>
> Indeed. It was originally meant to say false if you can trust
> TYPE_DOMAIN of the array but now it says false if there's some means
> to constrain the array size (the DECL_P path and now your STRING_CST
> one). But all callers afterwards just look at TYPE_DOMAIN ...
So shall we verify that TYPE_DOMAIN is consistent with the object size
in that case inside of array_at_struct_end_p?
> > > I'd restructure the patch quite different, using for_each_index on the
> > > ref gather an array of index pointers (bail out on sth unhandled).
> > > Then I'd see if I have interesting ranges for them, if not, bail out.
> > > Also compute the size product of all ranges and test that against
> > > PARAM_MAX_VRP_CONSTANT_ARRAY_LOADS. Then store the minimum range
> > > value in the index places (temporarily) and use get_base_ref_and_extent to
> > > get at the constant "starting" offset. From there iterate using
> > > the remembered indices (remember the ref tree as well via for_each_index),
> > > directly adjusting the constant offset so you can feed
> > > fold_ctor_reference the constant offsets of all elements that need to
> > > be considered. As optimization fold_ctor_reference would know how
> > > to start from the "last" offset (much refactoring would need to be
> > > done here given nested ctors and multiple indices I guess).
> >
> > But for this, don't you want to take it over?
>
> I can try. Is there a PR for this?
Ok, filed PR80603, it is now all yours.
> > I agree that the current implementation is not very efficient and that is
> > why it is also limited to that small number of iterations.
> > As many cases just aren't able to use the valueize callback, handling
> > arbitrary numbers of non-constant indexes would be harder.
>
> Sure. I'd have expected you simply handle ARRAY_REF of a VAR_DECL
> and nothing else ;)
That would be too simple and boring ;)
Jakub
prev parent reply other threads:[~2017-05-03 8:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-21 18:09 [RFC PATCH] Optimize in VRP loads from constant arrays Jakub Jelinek
2017-04-21 18:36 ` Richard Biener
2017-04-29 17:27 ` [PATCH] Optimize in VRP loads from constant arrays (take 2) Jakub Jelinek
2017-05-02 11:16 ` Richard Biener
2017-05-02 12:12 ` Jakub Jelinek
2017-05-02 12:54 ` Richard Biener
2017-05-03 8:10 ` Jakub Jelinek [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=20170503080359.GJ1809@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@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).