PR profile/24093 (negative counts)
Jan Hubicka
jh@suse.cz
Mon Oct 31 21:08:00 GMT 2005
Hi,
this patch fixes the other half of problem. It turns out that the
profile missmatch produced by recursive inlining (that is avoidable but
likely not worthwhile) propagate into negative counts that in general
might happen in other cases too (due to roundoff errors), so I just
added code checking it.
Bootstrapped/regtested i686-pc-gnu-linux, comitted.
2005-10-31 Jan Hubicka <jh@suse.cz>
PR middle-end/24093
* cgraph.c (cgraph_clone_edge, cgraph_clone_node): Watch negative
counts.
Index: cgraph.c
===================================================================
--- cgraph.c (revision 106281)
+++ cgraph.c (working copy)
@@ -895,7 +895,11 @@ cgraph_clone_edge (struct cgraph_edge *e
new->inline_failed = e->inline_failed;
if (update_original)
- e->count -= new->count;
+ {
+ e->count -= new->count;
+ if (e->count < 0)
+ e->count = 0;
+ }
return new;
}
@@ -931,7 +935,11 @@ cgraph_clone_node (struct cgraph_node *n
else
count_scale = 0;
if (update_original)
- n->count -= count;
+ {
+ n->count -= count;
+ if (n->count < 0)
+ n->count = 0;
+ }
for (e = n->callees;e; e=e->next_callee)
cgraph_clone_edge (e, new, e->call_stmt, count_scale, loop_nest,
More information about the Gcc-patches
mailing list