Eliminate write-only variables

Richard Biener richard.guenther@gmail.com
Tue Jun 3 09:15:00 GMT 2014


On Mon, Jun 2, 2014 at 8:59 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
>>
>> Yeah, I discussed this with martin today on irc.  For aliasing we'd like to know whether a decl possibly has its address taken. Currently we only trust TREE_ADDRESSABLE for statics - and lto might change those to hidden visibility public :(
>>
>> So we want deck_referred_to_by_single_function
>
> OK, I will implement this one in IPA mini-pass.  It is easy.
> This property changes by clonning and inlining. What Martin wants to use it for?
> (I.e. my plan would be to compute it as last IPA pass making it useless for
> IPA analysis&propagation)

He doesn't want to use it but we talked and he said he'd have a look.

Note that it's important the decls are not refered to by global initializers
either.

Why is a new pass necessary - can't the IPA reference maintaining code
update some flag in the varpool magically?

>> and deck_may_have_address_taken.
>
> We currently clear TREE_ADDRESSABLE for statics that have no address taken at
> WPA time and that ought to keep the flag cleared at ltrans (I think I even made
> testcase for this)
>
> What I think we could improve is to not consider string functions as ADDR operations
> for this analysis, i.e. it is common to only memset to 0.
>
> How may_have_address_taken would differ here?

I want tree.h:may_be_aliased to return false if a decl doesn't have its address
taken.  We don't trust TREE_ADDRESSABLE for TREE_PUBLIC/DECL_EXTERNAL
decls because other TUs may take the address.  I want the check to be replaced
with sth more symtab aware, that is, bring in benefits from LTO (and at the same
time be not confused by statics brought public with hidden visibility).

Richard.

> Honza



More information about the Gcc-patches mailing list