Commit bade3a00 by Jan Hubicka Committed by Jan Hubicka

cfgloopmanip.c (scale_bbs_frequencies): Use RDIV macro

      * cfgloopmanip.c (scale_bbs_frequencies): Use RDIV macro
      * cfgloopanal.c (expected_loop_iterations): Change the return value

From-SVN: r81058
parent eddc836e
2004-04-22 Jan Hubicka <jh@suse.cz>
* cfgloopmanip.c (scale_bbs_frequencies): Use RDIV macro
* cfgloopanal.c (expected_loop_iterations): Change the return value
2004-04-22 Jakub Jelinek <jakub@redhat.com> 2004-04-22 Jakub Jelinek <jakub@redhat.com>
* cselib.h (struct elt_loc_list): Remove canon_loc field. * cselib.h (struct elt_loc_list): Remove canon_loc field.
......
...@@ -431,8 +431,8 @@ expected_loop_iterations (const struct loop *loop) ...@@ -431,8 +431,8 @@ expected_loop_iterations (const struct loop *loop)
count_in += e->count; count_in += e->count;
if (count_in == 0) if (count_in == 0)
return 0; expected = count_latch * 2;
else
expected = (count_latch + count_in - 1) / count_in; expected = (count_latch + count_in - 1) / count_in;
/* Avoid overflows. */ /* Avoid overflows. */
...@@ -452,7 +452,7 @@ expected_loop_iterations (const struct loop *loop) ...@@ -452,7 +452,7 @@ expected_loop_iterations (const struct loop *loop)
freq_in += EDGE_FREQUENCY (e); freq_in += EDGE_FREQUENCY (e);
if (freq_in == 0) if (freq_in == 0)
return 0; return freq_latch * 2;
return (freq_latch + freq_in - 1) / freq_in; return (freq_latch + freq_in - 1) / freq_in;
} }
......
...@@ -50,6 +50,8 @@ static void scale_bbs_frequencies (basic_block *, int, int, int); ...@@ -50,6 +50,8 @@ static void scale_bbs_frequencies (basic_block *, int, int, int);
static basic_block create_preheader (struct loop *, int); static basic_block create_preheader (struct loop *, int);
static void fix_irreducible_loops (basic_block); static void fix_irreducible_loops (basic_block);
#define RDIV(X,Y) (((X) + (Y) / 2) / (Y))
/* Splits basic block BB after INSN, returns created edge. Updates loops /* Splits basic block BB after INSN, returns created edge. Updates loops
and dominators. */ and dominators. */
edge edge
...@@ -458,7 +460,7 @@ scale_bbs_frequencies (basic_block *bbs, int nbbs, int num, int den) ...@@ -458,7 +460,7 @@ scale_bbs_frequencies (basic_block *bbs, int nbbs, int num, int den)
for (i = 0; i < nbbs; i++) for (i = 0; i < nbbs; i++)
{ {
bbs[i]->frequency = (bbs[i]->frequency * num) / den; bbs[i]->frequency = (bbs[i]->frequency * num) / den;
bbs[i]->count = (bbs[i]->count * num) / den; bbs[i]->count = RDIV (bbs[i]->count * num, den);
for (e = bbs[i]->succ; e; e = e->succ_next) for (e = bbs[i]->succ; e; e = e->succ_next)
e->count = (e->count * num) /den; e->count = (e->count * num) /den;
} }
...@@ -812,7 +814,6 @@ can_duplicate_loop_p (struct loop *loop) ...@@ -812,7 +814,6 @@ can_duplicate_loop_p (struct loop *loop)
return ret; return ret;
} }
#define RDIV(X,Y) (((X) + (Y) / 2) / (Y))
/* Duplicates body of LOOP to given edge E NDUPL times. Takes care of updating /* Duplicates body of LOOP to given edge E NDUPL times. Takes care of updating
LOOPS structure and dominators. E's destination must be LOOP header for LOOPS structure and dominators. E's destination must be LOOP header for
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment