Commit e466e2ce by Jan Hubicka Committed by Jan Hubicka

cgraphunit.c (verify_cgraph_node): Do checking that DECL match edge only when…

cgraphunit.c (verify_cgraph_node): Do checking that DECL match edge only when checking is enabled...

	* cgraphunit.c (verify_cgraph_node): Do checking that DECL match
	edge only when checking is enabled; check using former_clone_of;
	check inline clones too.
	(cgraph_materialize_clone): Record former_clone_of pointer.
	(cgraph_redirect_edge_call_stmt_to_callee): Assert that we are not
	combining redirections; dump args_to_skip bitmap
	(cgraph_materialize_all_clones): Do no redirection here.
	* ipa-inline.c (inline_transform): Do redirection here.
	* cgraph.h (struct cgraph_node): Add former_clone_of filed (enabled
	cheking only).

From-SVN: r159907
parent fc7e91eb
2010-05-26 Jan Hubicka <jh@suse.cz>
* cgraphunit.c (verify_cgraph_node): Do checking that DECL match
edge only when checking is enabled; check using former_clone_of;
check inline clones too.
(cgraph_materialize_clone): Record former_clone_of pointer.
(cgraph_redirect_edge_call_stmt_to_callee): Assert that we are not
combining redirections; dump args_to_skip bitmap
(cgraph_materialize_all_clones): Do no redirection here.
* ipa-inline.c (inline_transform): Do redirection here.
* cgraph.h (struct cgraph_node): Add former_clone_of filed (enabled
cheking only).
2010-05-26 Steven Bosscher <steven@gcc.gnu.org> 2010-05-26 Steven Bosscher <steven@gcc.gnu.org>
* config/avr/avr-c.c: Do not include regs.h. * config/avr/avr-c.c: Do not include regs.h.
......
...@@ -226,6 +226,10 @@ struct GTY((chain_next ("%h.next"), chain_prev ("%h.previous"))) cgraph_node { ...@@ -226,6 +226,10 @@ struct GTY((chain_next ("%h.next"), chain_prev ("%h.previous"))) cgraph_node {
/* For functions with many calls sites it holds map from call expression /* For functions with many calls sites it holds map from call expression
to the edge to speed up cgraph_edge function. */ to the edge to speed up cgraph_edge function. */
htab_t GTY((param_is (struct cgraph_edge))) call_site_hash; htab_t GTY((param_is (struct cgraph_edge))) call_site_hash;
#ifdef ENABLE_CHECKING
/* Declaration node used to be clone of. Used for checking only. */
tree former_clone_of;
#endif
PTR GTY ((skip)) aux; PTR GTY ((skip)) aux;
......
...@@ -801,9 +801,12 @@ verify_cgraph_node (struct cgraph_node *node) ...@@ -801,9 +801,12 @@ verify_cgraph_node (struct cgraph_node *node)
debug_tree (e->callee->decl); debug_tree (e->callee->decl);
error_found = true; error_found = true;
} }
else if (!node->global.inlined_to #ifdef ENABLE_CHECKING
&& !e->callee->global.inlined_to else if (!e->callee->global.inlined_to
&& decl && decl
&& cgraph_get_node (decl)
&& (e->callee->former_clone_of
!= cgraph_get_node (decl)->decl)
&& !clone_of_p (cgraph_node (decl), && !clone_of_p (cgraph_node (decl),
e->callee)) e->callee))
{ {
...@@ -813,6 +816,7 @@ verify_cgraph_node (struct cgraph_node *node) ...@@ -813,6 +816,7 @@ verify_cgraph_node (struct cgraph_node *node)
debug_tree (decl); debug_tree (decl);
error_found = true; error_found = true;
} }
#endif
} }
else if (decl) else if (decl)
{ {
...@@ -2284,6 +2288,11 @@ static void ...@@ -2284,6 +2288,11 @@ static void
cgraph_materialize_clone (struct cgraph_node *node) cgraph_materialize_clone (struct cgraph_node *node)
{ {
bitmap_obstack_initialize (NULL); bitmap_obstack_initialize (NULL);
#ifdef ENABLE_CHECKING
node->former_clone_of = node->clone_of->decl;
if (node->clone_of->former_clone_of)
node->former_clone_of = node->clone_of->former_clone_of;
#endif
/* Copy the OLD_VERSION_NODE function tree to the new version. */ /* Copy the OLD_VERSION_NODE function tree to the new version. */
tree_function_versioning (node->clone_of->decl, node->decl, tree_function_versioning (node->clone_of->decl, node->decl,
node->clone.tree_map, true, node->clone.tree_map, true,
...@@ -2324,12 +2333,19 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e) ...@@ -2324,12 +2333,19 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e)
|| cgraph_get_node (decl) == cgraph_get_node (e->callee->decl)) || cgraph_get_node (decl) == cgraph_get_node (e->callee->decl))
return e->call_stmt; return e->call_stmt;
gcc_assert (!cgraph_node (decl)->clone.combined_args_to_skip);
if (cgraph_dump_file) if (cgraph_dump_file)
{ {
fprintf (cgraph_dump_file, "updating call of %s/%i -> %s/%i: ", fprintf (cgraph_dump_file, "updating call of %s/%i -> %s/%i: ",
cgraph_node_name (e->caller), e->caller->uid, cgraph_node_name (e->caller), e->caller->uid,
cgraph_node_name (e->callee), e->callee->uid); cgraph_node_name (e->callee), e->callee->uid);
print_gimple_stmt (cgraph_dump_file, e->call_stmt, 0, dump_flags); print_gimple_stmt (cgraph_dump_file, e->call_stmt, 0, dump_flags);
if (e->callee->clone.combined_args_to_skip)
{
fprintf (cgraph_dump_file, " combined args to skip: ");
dump_bitmap (cgraph_dump_file, e->callee->clone.combined_args_to_skip);
}
} }
if (e->callee->clone.combined_args_to_skip) if (e->callee->clone.combined_args_to_skip)
...@@ -2436,31 +2452,7 @@ cgraph_materialize_all_clones (void) ...@@ -2436,31 +2452,7 @@ cgraph_materialize_all_clones (void)
if (!node->analyzed && node->callees) if (!node->analyzed && node->callees)
cgraph_node_remove_callees (node); cgraph_node_remove_callees (node);
if (cgraph_dump_file) if (cgraph_dump_file)
fprintf (cgraph_dump_file, "Updating call sites\n");
for (node = cgraph_nodes; node; node = node->next)
if (node->analyzed && !node->clone_of
&& gimple_has_body_p (node->decl))
{
struct cgraph_edge *e;
current_function_decl = node->decl;
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
for (e = node->callees; e; e = e->next_callee)
cgraph_redirect_edge_call_stmt_to_callee (e);
gcc_assert (!need_ssa_update_p (cfun));
pop_cfun ();
current_function_decl = NULL;
#ifdef ENABLE_CHECKING
verify_cgraph_node (node);
#endif
}
if (cgraph_dump_file)
fprintf (cgraph_dump_file, "Materialization Call site updates done.\n"); fprintf (cgraph_dump_file, "Materialization Call site updates done.\n");
/* All changes to parameters have been performed. In order not to
incorrectly repeat them, we simply dispose of the bitmaps that drive the
changes. */
for (node = cgraph_nodes; node; node = node->next)
node->clone.combined_args_to_skip = NULL;
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
verify_cgraph (); verify_cgraph ();
#endif #endif
......
...@@ -2035,6 +2035,7 @@ inline_transform (struct cgraph_node *node) ...@@ -2035,6 +2035,7 @@ inline_transform (struct cgraph_node *node)
{ {
unsigned int todo = 0; unsigned int todo = 0;
struct cgraph_edge *e; struct cgraph_edge *e;
bool inline_p = false;
/* FIXME: Currently the passmanager is adding inline transform more than once to some /* FIXME: Currently the passmanager is adding inline transform more than once to some
clones. This needs revisiting after WPA cleanups. */ clones. This needs revisiting after WPA cleanups. */
...@@ -2047,10 +2048,13 @@ inline_transform (struct cgraph_node *node) ...@@ -2047,10 +2048,13 @@ inline_transform (struct cgraph_node *node)
save_inline_function_body (node); save_inline_function_body (node);
for (e = node->callees; e; e = e->next_callee) for (e = node->callees; e; e = e->next_callee)
if (!e->inline_failed || warn_inline) {
break; cgraph_redirect_edge_call_stmt_to_callee (e);
if (!e->inline_failed || warn_inline)
inline_p = true;
}
if (e) if (inline_p)
{ {
timevar_push (TV_INTEGRATION); timevar_push (TV_INTEGRATION);
todo = optimize_inline_calls (current_function_decl); todo = optimize_inline_calls (current_function_decl);
......
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