Commit fd29c024 by Martin Liska Committed by Martin Liska

IPA ICF pass 1/N

	* gimple-iterator.h (gsi_next_nonvirtual_phi): New function.
	* ipa-prop.h (count_formal_params): Global function created from static.
	* ipa-prop.c (count_formal_params): Likewise.
	* ipa-utils.c (ipa_merge_profiles): Be more tolerant if we merge
	profiles for semantically equivalent functions.
	* passes.c (do_per_function): If we load body of a function
	during WPA, this condition should behave same.
	* varpool.c (ctor_for_folding): More tolerant assert for variable
	aliases created during WPA.

From-SVN: r213417
parent 0ef40c64
2014-08-01 Martin Liska <mliska@suse.cz> 2014-08-01 Martin Liska <mliska@suse.cz>
* gimple-iterator.h (gsi_next_nonvirtual_phi): New function.
* ipa-prop.h (count_formal_params): Global function created from static.
* ipa-prop.c (count_formal_params): Likewise.
* ipa-utils.c (ipa_merge_profiles): Be more tolerant if we merge
profiles for semantically equivalent functions.
* passes.c (do_per_function): If we load body of a function
during WPA, this condition should behave same.
* varpool.c (ctor_for_folding): More tolerant assert for variable
aliases created during WPA.
2014-08-01 Martin Liska <mliska@suse.cz>
* doc/invoke.texi (Options That Control Optimization): Documentation * doc/invoke.texi (Options That Control Optimization): Documentation
for -foptimize-strlen introduced. Optimization levels default options for -foptimize-strlen introduced. Optimization levels default options
fixed. fixed.
......
...@@ -281,6 +281,30 @@ gsi_last_nondebug_bb (basic_block bb) ...@@ -281,6 +281,30 @@ gsi_last_nondebug_bb (basic_block bb)
return i; return i;
} }
/* Iterates I statement iterator to the next non-virtual statement. */
static inline void
gsi_next_nonvirtual_phi (gimple_stmt_iterator *i)
{
gimple phi;
if (gsi_end_p (*i))
return;
phi = gsi_stmt (*i);
gcc_assert (phi != NULL);
while (virtual_operand_p (gimple_phi_result (phi)))
{
gsi_next (i);
if (gsi_end_p (*i))
return;
phi = gsi_stmt (*i);
}
}
/* Return the basic block associated with this iterator. */ /* Return the basic block associated with this iterator. */
static inline basic_block static inline basic_block
......
...@@ -212,7 +212,7 @@ ipa_populate_param_decls (struct cgraph_node *node, ...@@ -212,7 +212,7 @@ ipa_populate_param_decls (struct cgraph_node *node,
/* Return how many formal parameters FNDECL has. */ /* Return how many formal parameters FNDECL has. */
static inline int int
count_formal_params (tree fndecl) count_formal_params (tree fndecl)
{ {
tree parm; tree parm;
......
...@@ -529,6 +529,7 @@ void ipa_free_all_edge_args (void); ...@@ -529,6 +529,7 @@ void ipa_free_all_edge_args (void);
void ipa_free_all_structures_after_ipa_cp (void); void ipa_free_all_structures_after_ipa_cp (void);
void ipa_free_all_structures_after_iinln (void); void ipa_free_all_structures_after_iinln (void);
void ipa_register_cgraph_hooks (void); void ipa_register_cgraph_hooks (void);
int count_formal_params (tree fndecl);
/* This function ensures the array of node param infos is big enough to /* This function ensures the array of node param infos is big enough to
accommodate a structure for all nodes and reallocates it if not. */ accommodate a structure for all nodes and reallocates it if not. */
......
...@@ -660,13 +660,8 @@ ipa_merge_profiles (struct cgraph_node *dst, ...@@ -660,13 +660,8 @@ ipa_merge_profiles (struct cgraph_node *dst,
if (dst->tp_first_run > src->tp_first_run && src->tp_first_run) if (dst->tp_first_run > src->tp_first_run && src->tp_first_run)
dst->tp_first_run = src->tp_first_run; dst->tp_first_run = src->tp_first_run;
if (src->profile_id) if (src->profile_id && !dst->profile_id)
{
if (!dst->profile_id)
dst->profile_id = src->profile_id; dst->profile_id = src->profile_id;
else
gcc_assert (src->profile_id == dst->profile_id);
}
if (!dst->count) if (!dst->count)
return; return;
......
...@@ -1478,7 +1478,7 @@ do_per_function (void (*callback) (function *, void *data), void *data) ...@@ -1478,7 +1478,7 @@ do_per_function (void (*callback) (function *, void *data), void *data)
{ {
struct cgraph_node *node; struct cgraph_node *node;
FOR_EACH_DEFINED_FUNCTION (node) FOR_EACH_DEFINED_FUNCTION (node)
if (node->analyzed && gimple_has_body_p (node->decl) if (node->analyzed && (gimple_has_body_p (node->decl) && !in_lto_p)
&& (!node->clone_of || node->decl != node->clone_of->decl)) && (!node->clone_of || node->decl != node->clone_of->decl))
callback (DECL_STRUCT_FUNCTION (node->decl), data); callback (DECL_STRUCT_FUNCTION (node->decl), data);
} }
......
...@@ -405,6 +405,7 @@ ctor_for_folding (tree decl) ...@@ -405,6 +405,7 @@ ctor_for_folding (tree decl)
if (decl != real_decl) if (decl != real_decl)
{ {
gcc_assert (!DECL_INITIAL (decl) gcc_assert (!DECL_INITIAL (decl)
|| (node->alias && node->get_alias_target () == real_node)
|| DECL_INITIAL (decl) == error_mark_node); || DECL_INITIAL (decl) == error_mark_node);
if (node->weakref) if (node->weakref)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment