Tree profiling merge 6 - fix profile updating
Jan Hubicka
jh@suse.cz
Thu May 27 02:43:00 GMT 2004
Hi,
few places where we update CFG but not the profile. I've sent the patch
earlier with jump threading updating included, but Richard suggested to cmonize
the code there somehow. Thus this patch includes the other largery trivial
changes and I will look into how much work I can do on commonizing it (it is
not quite trivial as both jump threadings are designed in somewhat divergent
ways)
Bootstrapped/regtested i686-pc-gnu-linux, OK?
Honza
2004-05-26 Jan Hubicka <jh@suse.cz>
* tree-ssa-dce.c (remove_dead_stmt): Update profile.
* tree-cfg.c (tree_split_edge): Likewise.
(thread_jumps): Likewise.
Index: tree-ssa-dce.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dce.c,v
retrieving revision 2.3
retrieving revision 1.1.2.78.2.5
diff -c -3 -p -r2.3 -r1.1.2.78.2.5
*** tree-ssa-dce.c 14 May 2004 02:29:23 -0000 2.3
--- tree-ssa-dce.c 17 May 2004 22:19:55 -0000 1.1.2.78.2.5
*************** remove_dead_stmt (block_stmt_iterator *i
*** 710,715 ****
--- 710,717 ----
/* Redirect the first edge out of BB to reach POST_DOM_BB. */
redirect_edge_and_branch (bb->succ, post_dom_bb);
PENDING_STMT (bb->succ) = NULL;
+ bb->succ->probability = REG_BR_PROB_BASE;
+ bb->succ->count = bb->count;
/* The edge is no longer associated with a conditional, so it does
not have TRUE/FALSE flags. */
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.2
retrieving revision 1.1.4.267.2.14
diff -c -3 -p -r2.2 -r1.1.4.267.2.14
*** tree-cfg.c 15 May 2004 23:07:51 -0000 2.2
--- tree-cfg.c 17 May 2004 22:19:54 -0000 1.1.4.267.2.14
*************** tree_split_edge (edge edge_in)
*** 2954,2960 ****
--- 2994,3004 ----
after_bb = edge_in->src;
new_bb = create_empty_bb (after_bb);
+ new_bb->frequency = EDGE_FREQUENCY (edge_in);
+ new_bb->count = edge_in->count;
new_edge = make_edge (new_bb, dest, EDGE_FALLTHRU);
+ new_edge->probability = REG_BR_PROB_BASE;
+ new_edge->count = edge_in->count;
/* Find all the PHI arguments on the original edge, and change them to
the new edge. Do it before redirection, so that the argument does not
*************** thread_jumps (void)
*** 3703,3708 ****
--- 3747,3754 ----
forwardable. */
for (e = bb->succ; e; e = next)
{
+ int freq;
+ gcov_type count;
next = e->succ_next;
/* If the edge is abnormal or its destination is not
*************** thread_jumps (void)
*** 3711,3716 ****
--- 3757,3765 ----
|| !tree_forwarder_block_p (e->dest))
continue;
+ count = e->count;
+ freq = EDGE_FREQUENCY (e);
+
/* Now walk through as many forwarder block as possible to
find the ultimate destination we want to thread our jump
to. */
*************** thread_jumps (void)
*** 3730,3735 ****
--- 3779,3793 ----
break;
bb_ann (dest)->forwardable = 0;
+ dest->frequency -= freq;
+ if (dest->frequency < 0)
+ dest->frequency = 0;
+ dest->count -= count;
+ if (dest->count < 0)
+ dest->count = 0;
+ dest->succ->count -= count;
+ if (dest->succ->count < 0)
+ dest->succ->count = 0;
}
/* Reset the forwardable marks to 1. */
More information about the Gcc-patches
mailing list