* [rtlopt] update profile properly for runtime unrolling
@ 2002-10-25 15:08 Jan Hubicka
0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2002-10-25 15:08 UTC (permalink / raw)
To: gcc-patches, rakdver
Hi,
minor problem I guess, but we were updating the profile incorrectly
here.
Sat Oct 26 02:16:39 CEST 2002 Jan Hubicka <jh@suse.cz>
* unroll.c (unroll_loop_runtime_iterations): Compute edge probabilities properly.
*** loop-unroll.c.old1 Sat Oct 26 01:44:17 2002
--- loop-unroll.c Sat Oct 26 02:09:08 2002
*************** unroll_loop_runtime_iterations (loops, l
*** 356,371 ****
for (i = 0; i < n_peel; i++)
{
start_sequence ();
niter = expand_simple_binop (GET_MODE (desc->var), MINUS,
niter, const1_rtx,
NULL_RTX, 0, OPTAB_LIB_WIDEN);
if (i || !skip_first_test)
{
do_compare_rtx_and_jump (copy_rtx (niter), const0_rtx, EQ, 0,
GET_MODE (desc->var), NULL_RTX, NULL_RTX,
loop_beg_label);
! JUMP_LABEL (get_last_insn ()) = loop_beg_label;
LABEL_NUSES (loop_beg_label)++;
}
branch_code = get_insns ();
--- 356,378 ----
for (i = 0; i < n_peel; i++)
{
+ edge e;
start_sequence ();
niter = expand_simple_binop (GET_MODE (desc->var), MINUS,
niter, const1_rtx,
NULL_RTX, 0, OPTAB_LIB_WIDEN);
if (i || !skip_first_test)
{
+ rtx jump;
do_compare_rtx_and_jump (copy_rtx (niter), const0_rtx, EQ, 0,
GET_MODE (desc->var), NULL_RTX, NULL_RTX,
loop_beg_label);
! jump = get_last_insn ();
! JUMP_LABEL (jump) = loop_beg_label;
! REG_NOTES (jump)
! = gen_rtx_EXPR_LIST (REG_BR_PROB,
! GEN_INT (REG_BR_PROB_BASE / (n_peel - i + 1)), REG_NOTES (jump));
!
LABEL_NUSES (loop_beg_label)++;
}
branch_code = get_insns ();
*************** unroll_loop_runtime_iterations (loops, l
*** 374,379 ****
--- 381,391 ----
preheader =
loop_split_edge_with (loop_preheader_edge (loop), branch_code, loops);
+ e = loop_preheader_edge (loop);
+ /* Now lower the probablity of the edge as the other edge will handle it. */
+ e->probability = REG_BR_PROB_BASE - (REG_BR_PROB_BASE / (n_peel - i + 1));
+ e->count = e->count * e->probability / REG_BR_PROB_BASE;
+
if (i || !skip_first_test)
make_edge (preheader, fake, 0);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-10-25 22:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-25 15:08 [rtlopt] update profile properly for runtime unrolling Jan Hubicka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).