From: Jan Hubicka <hubicka@ucw.cz>
To: "Martin Liška" <mliska@suse.cz>
Cc: "gcc-pat >> GCC Patches" <gcc-patches@gcc.gnu.org>,
"hubicka >> Jan Hubicka" <hubicka@ucw.cz>
Subject: Re: [PATCH] ICF: move readonly decision for variables to the right place
Date: Sun, 01 Mar 2015 00:26:00 -0000 [thread overview]
Message-ID: <20150301002635.GG20437@kam.mff.cuni.cz> (raw)
In-Reply-To: <54F25A19.10903@suse.cz>
> diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
> index 864a5d0..5b1fcff 100644
> --- a/gcc/ipa-icf.c
> +++ b/gcc/ipa-icf.c
> @@ -1410,10 +1410,6 @@ sem_variable::parse (varpool_node *node, bitmap_obstack *stack)
> if (node->alias)
> return NULL;
>
> - bool readonly = TYPE_P (decl) ? TYPE_READONLY (decl) : TREE_READONLY (decl);
> - if (!readonly)
> - return NULL;
> -
> bool can_handle = DECL_VIRTUAL_P (decl)
> || flag_merge_constants >= 2
> || (!TREE_ADDRESSABLE (decl) && !node->externally_visible);
Please also drop can_handle and DECL_EXTERNAL check here.
can_handle seems to test if address matters. We already verify it at merging time
and at a time we consider REF_ADDR references. This is enough.
Moreover TREE_ADDRESSABLE and externally_visible flags are subject to change in between
analysis and WPA time.
Instead of this punt if THIS_VOLATILE is true.
Instead of ctor_for_folding bellow use DECL_INITIAL (ctor_for_folding may return
you NULL if it thinks the var is not safe)
> @@ -1900,7 +1896,14 @@ sem_item_optimizer::filter_removed_items (void)
> if (!flag_ipa_icf_variables)
> remove_item (item);
> else
> - filtered.safe_push (item);
> + {
> + /* Filter out non-readonly variables. */
> + tree decl = item->decl;
> + if (TYPE_P (decl) ? TYPE_READONLY (decl) : TREE_READONLY (decl))
Just test TREE_READONLY (decl).
OK with these changes.
Honza
next prev parent reply other threads:[~2015-03-01 0:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-01 0:15 Martin Liška
2015-03-01 0:26 ` Jan Hubicka [this message]
2015-03-02 0:58 ` Jan Hubicka
2015-03-02 7:53 ` Jan Hubicka
2015-03-02 9:47 ` Martin Liška
2015-03-06 14:38 ` H.J. Lu
2015-03-06 19:08 ` Jan Hubicka
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=20150301002635.GG20437@kam.mff.cuni.cz \
--to=hubicka@ucw.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=mliska@suse.cz \
/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).