summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-22 21:46:48 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-22 21:46:48 +0000
commitd04f7eb91682e4a29e6a1a24aeecb3799c04fe4e (patch)
treeff2786de6067078df56240e0b8d6d340cb186aac
parentcd0b0dd13eeb107cabf1cfa2b752f63fd9b9339d (diff)
downloadppe42-gcc-d04f7eb91682e4a29e6a1a24aeecb3799c04fe4e.tar.gz
ppe42-gcc-d04f7eb91682e4a29e6a1a24aeecb3799c04fe4e.zip
* cfgloopmanip.c (scale_bbs_frequencies): Use RDIV macro
* cfgloopanal.c (expected_loop_iterations): Change the return value git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81058 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/cfgloopanal.c8
-rw-r--r--gcc/cfgloopmanip.c5
3 files changed, 12 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index acde505da64..b13dc235231 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+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>
* cselib.h (struct elt_loc_list): Remove canon_loc field.
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c
index 63d6f4121b0..358bfa765b8 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -431,9 +431,9 @@ expected_loop_iterations (const struct loop *loop)
count_in += e->count;
if (count_in == 0)
- return 0;
-
- expected = (count_latch + count_in - 1) / count_in;
+ expected = count_latch * 2;
+ else
+ expected = (count_latch + count_in - 1) / count_in;
/* Avoid overflows. */
return (expected > REG_BR_PROB_BASE ? REG_BR_PROB_BASE : expected);
@@ -452,7 +452,7 @@ expected_loop_iterations (const struct loop *loop)
freq_in += EDGE_FREQUENCY (e);
if (freq_in == 0)
- return 0;
+ return freq_latch * 2;
return (freq_latch + freq_in - 1) / freq_in;
}
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 2dc46432aa9..59ae4a1ed7a 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -50,6 +50,8 @@ static void scale_bbs_frequencies (basic_block *, int, int, int);
static basic_block create_preheader (struct loop *, int);
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
and dominators. */
edge
@@ -458,7 +460,7 @@ scale_bbs_frequencies (basic_block *bbs, int nbbs, int num, int den)
for (i = 0; i < nbbs; i++)
{
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)
e->count = (e->count * num) /den;
}
@@ -812,7 +814,6 @@ can_duplicate_loop_p (struct loop *loop)
return ret;
}
-#define RDIV(X,Y) (((X) + (Y) / 2) / (Y))
/* 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
OpenPOWER on IntegriCloud