This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Eliminate write-only variables
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 19 May 2014 01:32:32 +0200
- Subject: Re: Eliminate write-only variables
- Authentication-results: sourceware.org; auth=none
- References: <20140516172559 dot GF20755 at kam dot mff dot cuni dot cz> <20140518213747 dot GA26736 at virgil dot suse dot cz>
> > + if (!address_taken)
> > {
> > - if (dump_file)
> > + if (TREE_ADDRESSABLE (vnode->decl) && dump_file)
> > fprintf (dump_file, " %s (addressable)", vnode->name ());
>
> I know it is technically not a part of the patch... but surely this is
> supposed to dump not addressable and might be quite a bit confusing,
> so if you are already changing this, correcting the dump would be
> great.
Yep, the original logic was that the variables appear in list of flags removed,
so we are removing addressable flag. The other two flags do not follow the
practice. I plan to cleanup this code in general (it has gathered quite some
clutter), so I will look into it next and get dumps more readable.
Honza
>
> Martin
>
> > - TREE_ADDRESSABLE (vnode->decl) = 0;
> > + varpool_for_node_and_aliases (vnode, clear_addressable_bit, NULL, true);
> > }
> > - if (!TREE_READONLY (vnode->decl) && !address_taken && !written
> > + if (!address_taken && !written
> > /* Making variable in explicit section readonly can cause section
> > type conflict.
> > See e.g. gcc.c-torture/compile/pr23237.c */
> > && DECL_SECTION_NAME (vnode->decl) == NULL)
> > {
> > - if (dump_file)
> > + if (!TREE_READONLY (vnode->decl) && dump_file)
> > fprintf (dump_file, " %s (read-only)", vnode->name ());
> > - TREE_READONLY (vnode->decl) = 1;
> > + varpool_for_node_and_aliases (vnode, set_readonly_bit, NULL, true);
> > + }
> > + if (!vnode->writeonly && !read && !address_taken)
> > + {
> > + if (dump_file)
> > + fprintf (dump_file, " %s (write-only)", vnode->name ());
> > + varpool_for_node_and_aliases (vnode, set_writeonly_bit, NULL, true);
> > }
> > }
> > if (dump_file)