> In non-LTO compilation I think it would allows us to optimize bettter in the
> case address of the global symbol can not be taken by the other unit or it
> can not escape back to current unit.  For C/C++ this would be for runtime
> generates symbols, like for gcov runtime (well if our initialization was
> not implemented in a way taking address of everything). For non-C languages
> I expect there are cases where you just can't take address of a given
> object.

Yes, that's true in Ada :-), at least theoritically since you need to 
explicitly mark objects with "aliased" to be able to take their address.

> For LTO compilation this is useful for optimizing cases where variable is
> static at whole program optimization time, but it becomes hidden by
> partitioning and at whole program time we figure out its address is not
> taken.

Then why not just make the LTO front-end follow the existing semantics of 
TREE_ADDRESSABLE and clear it when it figures out that the address is not 
taken?  That would seem the natural thing to do here.

-- 
Eric Botcazou

Reply via email to