diff mbox

Profile housekeeping 2/n (shrink wrapping fix)

Message ID 20120928201427.GA10031@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Sept. 28, 2012, 8:14 p.m. UTC
Hi,
this patch fixes updating in shrink wrapping.  Bootstrapped/regtested x86_64-linux.
Will commit it shortly.

Honza

	* function.c (dup_block_and_redirect): Update profile.
diff mbox

Patch

Index: function.c
===================================================================
--- function.c	(revision 191823)
+++ function.c	(working copy)
@@ -5668,6 +5668,15 @@  dup_block_and_redirect (basic_block bb,
   for (ei = ei_start (bb->preds); (e = ei_safe_edge (ei)); )
     if (!bitmap_bit_p (need_prologue, e->src->index))
       {
+	int freq = EDGE_FREQUENCY (e);
+	copy_bb->count += e->count;
+	copy_bb->frequency += EDGE_FREQUENCY (e);
+	e->dest->count -= e->count;
+	if (e->dest->count < 0)
+	  e->dest->count = 0;
+	e->dest->frequency -= freq;
+	if (e->dest->frequency < 0)
+	  e->dest->frequency = 0;
 	redirect_edge_and_branch_force (e, copy_bb);
 	continue;
       }