diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc index 5d5a42f9c6c..dff7ad6efda 100644 --- a/gcc/ipa-icf.cc +++ b/gcc/ipa-icf.cc @@ -284,6 +284,7 @@ sem_function::get_hash (void) hstate.add_int (177454); /* Random number for function type. */ hstate.add_int (arg_count); + hstate.add_int (static_chain_present); hstate.add_int (cfg_checksum); hstate.add_int (gcode_hash); @@ -655,7 +656,10 @@ sem_function::equals_wpa (sem_item *item, } if (list1 || list2) - return return_false_with_msg ("Mismatched number of parameters"); + return return_false_with_msg ("mismatched number of parameters"); + + if (static_chain_present != m_compared_func->static_chain_present) + return return_false_with_msg ("static chain mismatch"); if (node->num_references () != item->node->num_references ()) return return_false_with_msg ("different number of references"); @@ -876,7 +880,10 @@ sem_function::equals_private (sem_item *item) return return_false (); } if (arg1 || arg2) - return return_false_with_msg ("Mismatched number of arguments"); + return return_false_with_msg ("mismatched number of arguments"); + + if (static_chain_present != m_compared_func->static_chain_present) + return return_false_with_msg ("static chain mismatch"); if (!dyn_cast (node)->has_gimple_body_p ()) return true; @@ -1368,6 +1375,8 @@ sem_function::init (ipa_icf_gimple::func_checker *checker) /* iterating all function arguments. */ arg_count = count_formal_params (fndecl); + static_chain_present = func->static_chain_decl != NULL_TREE; + edge_count = n_edges_for_fn (func); cgraph_node *cnode = dyn_cast (node); if (!cnode->thunk) diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h index ef7e41bfa88..bd9fd9fb294 100644 --- a/gcc/ipa-icf.h +++ b/gcc/ipa-icf.h @@ -355,6 +355,9 @@ public: parameters. */ bool compatible_parm_types_p (tree, tree); + /* Return true if parameter I may be used. */ + bool param_used_p (unsigned int i); + /* Exception handling region tree. */ eh_region region_tree; @@ -379,6 +382,9 @@ public: /* Total number of SSA names used in the function. */ unsigned ssa_names_size; + /* Whether the special PARM_DECL for the static chain is present. */ + bool static_chain_present; + /* Array of structures for all basic blocks. */ vec bb_sorted; @@ -386,9 +392,6 @@ public: function. */ hashval_t m_alias_sets_hash; - /* Return true if parameter I may be used. */ - bool param_used_p (unsigned int i); - private: /* Calculates hash value based on a BASIC_BLOCK. */ hashval_t get_bb_hash (const ipa_icf_gimple::sem_bb *basic_block);