aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.h
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-02-27 03:06:48 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2015-02-27 02:06:48 +0000
commit0a7246ee3887147e6934684ecf768ebe929a975e (patch)
tree64340fdd45bcc8e11f6dbe5c80f68a86cce6c1fa /gcc/cgraph.h
parentf91f1c1312beaf16da0d12feea1696c91cb5f0a7 (diff)
downloadgcc-0a7246ee3887147e6934684ecf768ebe929a975e.zip
gcc-0a7246ee3887147e6934684ecf768ebe929a975e.tar.gz
gcc-0a7246ee3887147e6934684ecf768ebe929a975e.tar.bz2
re PR bootstrap/65150 (r220875 causes bootstrap failure on x86_64 darwin)
PR bootstrap/65150 * ipa-icf.c (symbol_compare_collection::symbol_compare_colleciton): Use address_matters_p. (redirect_all_callers, set_addressable): New functions. (sem_function::merge): Reorganize and fix merging issues. (sem_variable::merge): Likewise. (sem_variable::compare_sections): Remove. * common.opt (fmerge-all-constants, fmerge-constants): Remove Optimization flag. * symtab.c (symtab_node::resolve_alias): When alias has aliases, redirect them. (symtab_node::make_decl_local): Set ADDRESSABLE bit when decl is used. (address_matters_1): New function. (symtab_node::address_matters_p): New function. * cgraph.c (cgraph_edge::verify_corresponds_to_fndecl): Fix check for merged flag. * cgraph.h (address_matters_p): Declare. (symtab_node::address_taken_from_non_vtable_p): Remove. (symtab_node::address_can_be_compared_p): New method. (ipa_ref::address_matters_p): Move here from ipa-ref.c; simplify. * ipa-visibility.c (symtab_node::address_taken_from_non_vtable_p): Remove. (comdat_can_be_unshared_p_1) Use address_matters_p. (update_vtable_references): Fix formating. * ipa-ref.c (ipa_ref::address_matters_p): Move inline. * cgraphunit.c (cgraph_node::create_wrapper): Drop UNINLINABLE flag. * cgraphclones.c: Preserve merged and icf_merged flags. Co-Authored-By: Martin Liska <mliska@suse.cz> From-SVN: r221040
Diffstat (limited to 'gcc/cgraph.h')
-rw-r--r--gcc/cgraph.h49
1 files changed, 46 insertions, 3 deletions
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index ec3cccd..ff437cf 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -326,9 +326,6 @@ public:
/* Return true if ONE and TWO are part of the same COMDAT group. */
inline bool in_same_comdat_group_p (symtab_node *target);
- /* Return true when there is a reference to node and it is not vtable. */
- bool address_taken_from_non_vtable_p (void);
-
/* Return true if symbol is known to be nonzero. */
bool nonzero_address ();
@@ -337,6 +334,15 @@ public:
return 2 otherwise. */
int equal_address_to (symtab_node *s2);
+ /* Return true if symbol's address may possibly be compared to other
+ symbol's address. */
+ bool address_matters_p ();
+
+ /* Return true if NODE's address can be compared. This use properties
+ of NODE only and does not look if the address is actually taken in
+ interesting way. For that use ADDRESS_MATTERS_P instead. */
+ bool address_can_be_compared_p (void);
+
/* Return symbol table node associated with DECL, if any,
and NULL otherwise. */
static inline symtab_node *get (const_tree decl)
@@ -3022,6 +3028,43 @@ varpool_node::call_for_symbol_and_aliases (bool (*callback) (varpool_node *,
return false;
}
+/* Return true if NODE's address can be compared. */
+
+inline bool
+symtab_node::address_can_be_compared_p ()
+{
+ /* Address of virtual tables and functions is never compared. */
+ if (DECL_VIRTUAL_P (decl))
+ return false;
+ /* Address of C++ cdtors is never compared. */
+ if (is_a <cgraph_node *> (this)
+ && (DECL_CXX_CONSTRUCTOR_P (decl)
+ || DECL_CXX_DESTRUCTOR_P (decl)))
+ return false;
+ /* Constant pool symbols addresses are never compared.
+ flag_merge_constants permits us to assume the same on readonly vars. */
+ if (is_a <varpool_node *> (this)
+ && (DECL_IN_CONSTANT_POOL (decl)
+ || (flag_merge_constants >= 2
+ && TREE_READONLY (decl) && !TREE_THIS_VOLATILE (decl))))
+ return false;
+ return true;
+}
+
+/* Return true if refernece may be used in address compare. */
+
+inline bool
+ipa_ref::address_matters_p ()
+{
+ if (use != IPA_REF_ADDR)
+ return false;
+ /* Addresses taken from virtual tables are never compared. */
+ if (is_a <varpool_node *> (referring)
+ && DECL_VIRTUAL_P (referring->decl))
+ return false;
+ return referred->address_can_be_compared_p ();
+}
+
/* Build polymorphic call context for indirect call E. */
inline