This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
One more cgraph frequency bug
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 16 Nov 2009 21:47:42 +0100
- Subject: One more cgraph frequency bug
Hi,
this fixes the obvious bug in accessing removed node and adds sanity check.
Bootstrapped/regtested x86_64-linux, comitted.
Index: ChangeLog
===================================================================
*** ChangeLog (revision 154205)
--- ChangeLog (working copy)
***************
*** 1,5 ****
--- 1,11 ----
2009-11-14 Jan Hubicka <jh@suse.cz>
+ * cgraph.c (cgraph_update_edges_for_call_stmt_node): Do not access
+ removed node.
+ * cgraphunit.c (verify_cgraph_node): Verify frequencies for match.
+
+ 2009-11-14 Jan Hubicka <jh@suse.cz>
+
* cgraphbuild.c (compute_call_stmt_bb_frequency): Use proper ENTRY_BLOCK_PTR.
* cgraph.c (cgraph_clone_edge): Avoid freq_scale 0 to completely zero out all
callees.
Index: cgraph.c
===================================================================
*** cgraph.c (revision 154205)
--- cgraph.c (working copy)
*************** cgraph_update_edges_for_call_stmt_node (
*** 1000,1009 ****
/* Otherwise remove edge and create new one; we can't simply redirect
since function has changed, so inline plan and other information
attached to edge is invalid. */
- cgraph_remove_edge (e);
count = e->count;
frequency = e->frequency;
loop_nest = e->loop_nest;
}
else
{
--- 1000,1009 ----
/* Otherwise remove edge and create new one; we can't simply redirect
since function has changed, so inline plan and other information
attached to edge is invalid. */
count = e->count;
frequency = e->frequency;
loop_nest = e->loop_nest;
+ cgraph_remove_edge (e);
}
else
{
Index: cgraphunit.c
===================================================================
*** cgraphunit.c (revision 154200)
--- cgraphunit.c (working copy)
*************** verify_cgraph_node (struct cgraph_node *
*** 620,625 ****
--- 620,637 ----
error ("caller edge frequency is too large");
error_found = true;
}
+ if (gimple_has_body_p (e->caller->decl)
+ && !e->caller->global.inlined_to
+ && (e->frequency
+ != compute_call_stmt_bb_frequency (e->caller->decl,
+ gimple_bb (e->call_stmt))))
+ {
+ error ("caller edge frequency %i does not match BB freqency %i",
+ e->frequency,
+ compute_call_stmt_bb_frequency (e->caller->decl,
+ gimple_bb (e->call_stmt)));
+ error_found = true;
+ }
if (!e->inline_failed)
{
if (node->global.inlined_to