This makes may_be_aliased trust TREE_ADDRESSABLE setting for exported decls. This should make it possible for LTO to compute more optimistic aliasing and removes the pessimization with respective to aliasing that currently LTO brought global (but hidden visibility) statics cause.
Bootstrapped and tested on x86_64-unknown-linux-gnu for all languages including obj-c++, ada and go (yay), applied. Richard. 2014-06-04 Richard Biener <rguent...@suse.de> * tree.h (may_be_aliased): Trust TREE_ADDRESSABLE from TREE_PUBLIC and DECL_EXTERNAL decls. Index: gcc/tree.h =================================================================== --- gcc/tree.h (revision 211215) +++ gcc/tree.h (working copy) @@ -4506,9 +4506,7 @@ static inline bool may_be_aliased (const_tree var) { return (TREE_CODE (var) != CONST_DECL - && (TREE_PUBLIC (var) - || DECL_EXTERNAL (var) - || TREE_ADDRESSABLE (var)) + && TREE_ADDRESSABLE (var) && !((TREE_STATIC (var) || TREE_PUBLIC (var) || DECL_EXTERNAL (var)) && ((TREE_READONLY (var) && !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (var)))