aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-icf.h
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2015-02-26 21:21:38 +0100
committerMartin Liska <marxin@gcc.gnu.org>2015-02-26 20:21:38 +0000
commit5ebd0e6155dcb7ebecf278731aad189be79bb456 (patch)
tree31bd542ab4137d5e5826c62a637c3f0f03c24b46 /gcc/ipa-icf.h
parentff5ed3f6def9e24f907c6b9df66b9a582b327ac9 (diff)
downloadgcc-5ebd0e6155dcb7ebecf278731aad189be79bb456.zip
gcc-5ebd0e6155dcb7ebecf278731aad189be79bb456.tar.gz
gcc-5ebd0e6155dcb7ebecf278731aad189be79bb456.tar.bz2
re PR lto/64693 (PCH failed with --with-build-config=bootstrap-lto)
Fix PR ipa/64693 PR ipa/64693 * ipa-icf.c (symbol_compare_collection::symbol_compare_collection): New. (sem_item_optimizer::subdivide_classes_by_sensitive_refs): New function. (sem_item_optimizer::process_cong_reduction): Include division by sensitive references. * ipa-icf.h (struct symbol_compare_hashmap_traits): New class. * ipa-ref.c (ipa_ref::address_matters_p): New function. * ipa-ref.h (ipa_ref::address_matters_p): Likewise. * g++.dg/ipa/pr64146.C: Update expected results. * gcc.dg/ipa/ipa-icf-26.c: Update test. * gcc.dg/ipa/ipa-icf-33.c: Remove redundant line. * gcc.dg/ipa/ipa-icf-34.c: New test. Co-Authored-By: Jan Hubicka <hubicka@ucw.cz> From-SVN: r221031
Diffstat (limited to 'gcc/ipa-icf.h')
-rw-r--r--gcc/ipa-icf.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h
index a55699b..9e76239 100644
--- a/gcc/ipa-icf.h
+++ b/gcc/ipa-icf.h
@@ -63,6 +63,70 @@ enum sem_item_type
VAR
};
+/* Class is container for address references for a symtab_node. */
+
+class symbol_compare_collection
+{
+public:
+ /* Constructor. */
+ symbol_compare_collection (symtab_node *node);
+
+ /* Destructor. */
+ ~symbol_compare_collection ()
+ {
+ m_references.release ();
+ m_interposables.release ();
+ }
+
+ /* Vector of address references. */
+ vec<symtab_node *> m_references;
+
+ /* Vector of interposable references. */
+ vec<symtab_node *> m_interposables;
+};
+
+/* Hash traits for symbol_compare_collection map. */
+
+struct symbol_compare_hashmap_traits: default_hashmap_traits
+{
+ static hashval_t
+ hash (const symbol_compare_collection *v)
+ {
+ inchash::hash hstate;
+ hstate.add_int (v->m_references.length ());
+
+ for (unsigned i = 0; i < v->m_references.length (); i++)
+ hstate.add_ptr (v->m_references[i]->ultimate_alias_target ());
+
+ hstate.add_int (v->m_interposables.length ());
+
+ for (unsigned i = 0; i < v->m_interposables.length (); i++)
+ hstate.add_ptr (v->m_interposables[i]->ultimate_alias_target ());
+
+ return hstate.end ();
+ }
+
+ static bool
+ equal_keys (const symbol_compare_collection *a,
+ const symbol_compare_collection *b)
+ {
+ if (a->m_references.length () != b->m_references.length ())
+ return false;
+
+ for (unsigned i = 0; i < a->m_references.length (); i++)
+ if (a->m_references[i]->equal_address_to (b->m_references[i]) != 1)
+ return false;
+
+ for (unsigned i = 0; i < a->m_interposables.length (); i++)
+ if (!a->m_interposables[i]->semantically_equivalent_p
+ (b->m_interposables[i]))
+ return false;
+
+ return true;
+ }
+};
+
+
/* Semantic item usage pair. */
class sem_usage_pair
{
@@ -467,6 +531,13 @@ private:
classes. If IN_WPA, fast equality function is invoked. */
void subdivide_classes_by_equality (bool in_wpa = false);
+ /* Subdivide classes by address and interposable references
+ that members of the class reference.
+ Example can be a pair of functions that have an address
+ taken from a function. If these addresses are different the class
+ is split. */
+ unsigned subdivide_classes_by_sensitive_refs();
+
/* Debug function prints all informations about congruence classes. */
void dump_cong_classes (void);