From: "Martin Liška" <mliska@suse.cz>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Jason Merrill <jason@redhat.com>,
Joseph Myers <joseph@codesourcery.com>,
gcc-patches List <gcc-patches@gcc.gnu.org>,
Richard Biener <richard.guenther@gmail.com>
Subject: Re: [RFC][PATCH] Do refactoring of attribute functions and move them to attribs.[hc].
Date: Tue, 12 Sep 2017 14:25:00 -0000 [thread overview]
Message-ID: <dff1245e-4ba1-25ff-bd39-ccfceeb77252@suse.cz> (raw)
In-Reply-To: <20170912113951.GG1701@tucnak>
On 09/12/2017 01:39 PM, Jakub Jelinek wrote:
> On Tue, Sep 12, 2017 at 01:31:47PM +0200, Martin Liška wrote:
>> >From a40c06fc06afcb7bb886d7a3106e6da631a48430 Mon Sep 17 00:00:00 2001
>> From: marxin <mliska@suse.cz>
>> Date: Tue, 12 Sep 2017 13:30:39 +0200
>> Subject: [PATCH] Reduce lookup_attribute memory footprint.
>>
>> gcc/ChangeLog:
>>
>> 2017-09-12 Martin Liska <mliska@suse.cz>
>>
>> * attribs.c (private_lookup_attribute): New function.
>> * attribs.h (private_lookup_attribute): Declared here.
>> (lookup_attribute): Called from this place.
>> ---
>> gcc/attribs.c | 17 +++++++++++++++++
>> gcc/attribs.h | 17 ++++++-----------
>> 2 files changed, 23 insertions(+), 11 deletions(-)
>>
>> diff --git a/gcc/attribs.c b/gcc/attribs.c
>> index b8f58a74596..9064434e5f2 100644
>> --- a/gcc/attribs.c
>> +++ b/gcc/attribs.c
>> @@ -1584,3 +1584,20 @@ attribute_list_contained (const_tree l1, const_tree l2)
>>
>> return 1;
>> }
>> +
>> +
>
> Can you please add a function comment (and in addition to arguments explain
> there why lookup_attribute is split into the two parts)?
Yes.
>
>> +tree
>> +private_lookup_attribute (const char *attr_name, size_t attr_len, tree list)
>> +{
>> + while (list)
>> + {
>
>> @@ -151,17 +156,7 @@ lookup_attribute (const char *attr_name, tree list)
>> /* Do the strlen() before calling the out-of-line implementation.
>> In most cases attr_name is a string constant, and the compiler
>> will optimize the strlen() away. */
>
> Part of the comment is of course here and that comment didn't make any sense
> when everything was inlined.
You're completely right.
>
>> - while (list)
>> - {
>> - tree attr = get_attribute_name (list);
>> - size_t ident_len = IDENTIFIER_LENGTH (attr);
>> - if (cmp_attribs (attr_name, attr_len, IDENTIFIER_POINTER (attr),
>> - ident_len))
>> - break;
>> - list = TREE_CHAIN (list);
>> - }
>> -
>> - return list;
>> + return private_lookup_attribute (attr_name, attr_len, list);
>> }
>> }
>
> LGTM with the comment added. In theory fnsplit could handle that too,
> but 1) it would emit out of line stuff in every TU separately 2) the
> compiler doesn't know that NULL DECL_ATTRIBUTES is so common (it could
> with profiledbootstrap). And of course LTO can decide to inline it
> from attribs.c back anyway if there are reasons why it would be beneficial
> somewhere (but I doubt it is beneficial at least in most spots).
Doing it as it was is the right way ;)
Installed as r252022.
Martin
>
> Jakub
>
next prev parent reply other threads:[~2017-09-12 14:25 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-13 12:32 [PATCH][RFC] Canonize names of attributes Martin Liška
2017-06-13 13:20 ` Richard Biener
2017-06-14 7:48 ` Martin Liška
2017-06-14 9:07 ` Richard Biener
2017-06-14 11:03 ` Martin Liška
2017-06-14 11:19 ` Richard Biener
2017-06-14 16:40 ` Joseph Myers
2017-06-28 14:45 ` Martin Liška
2017-06-14 17:24 ` Jason Merrill
2017-06-16 0:07 ` Martin Sebor
2017-06-28 14:46 ` Martin Liška
2017-06-28 16:06 ` Joseph Myers
2017-06-28 19:01 ` Jason Merrill
2017-06-30 9:23 ` [PATCH v2][RFC] " Martin Liška
2017-06-30 19:35 ` Jason Merrill
2017-07-03 9:52 ` Martin Liška
2017-07-03 21:00 ` Jason Merrill
2017-07-11 13:38 ` Martin Liška
2017-07-11 15:52 ` Jason Merrill
2017-07-13 13:48 ` Martin Liška
2017-07-13 13:51 ` [RFC][PATCH] Do refactoring of attribute functions and move them to attribs.[hc] Martin Liška
2017-07-14 7:23 ` Jeff Law
2017-07-14 7:40 ` Martin Liška
2017-08-04 13:53 ` Martin Liška
2017-08-08 4:37 ` Martin Liška
2017-08-08 9:14 ` Tom de Vries
2017-09-12 7:55 ` Jakub Jelinek
2017-09-12 11:31 ` Martin Liška
2017-09-12 11:40 ` Jakub Jelinek
2017-09-12 14:25 ` Martin Liška [this message]
2017-07-27 12:57 ` [PATCH v2][RFC] Canonize names of attributes Martin Liška
2017-08-02 11:25 ` Joseph Myers
2017-08-04 13:43 ` Martin Liška
2017-08-04 16:54 ` Jason Merrill
2017-08-07 16:44 ` [PATCH][OBVIOUS] Fix missing include of header file in mips.c Martin Liška
2017-08-07 17:10 ` [PATCH][OBVIOUS] Add missing header file attribs.h to couple of targets Martin Liška
2017-08-02 19:42 ` [PATCH v2][RFC] Canonize names of attributes Jason Merrill
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=dff1245e-4ba1-25ff-bd39-ccfceeb77252@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jason@redhat.com \
--cc=joseph@codesourcery.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).