OSDN Git Service

* cfg.c (update_bb_profile_for_threading): Fix profile updating.
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 16 Jul 2005 12:15:27 +0000 (12:15 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 16 Jul 2005 12:15:27 +0000 (12:15 +0000)
(scale_bbs_frequencies_int): Watch roundoff errors.
* predict.c (return_prediction): Initialize return_stmt.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102087 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cfg.c
gcc/predict.c

index 25cc46d..de6bad9 100644 (file)
@@ -1,5 +1,11 @@
 2005-07-16  Jan Hubicka  <jh@suse.cz>
 
 2005-07-16  Jan Hubicka  <jh@suse.cz>
 
+       * cfg.c (update_bb_profile_for_threading): Fix profile updating.
+       (scale_bbs_frequencies_int): Watch roundoff errors.
+       * predict.c (return_prediction): Initialize return_stmt.
+
+2005-07-16  Jan Hubicka  <jh@suse.cz>
+
        * profile.c (rest_of_handle_branch_prob): Fix handling of estimation
        after RTL profiling.
 
        * profile.c (rest_of_handle_branch_prob): Fix handling of estimation
        after RTL profiling.
 
index 6aeb794..e6af6cf 100644 (file)
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -896,7 +896,11 @@ update_bb_profile_for_threading (basic_block bb, int edge_frequency,
       int scale = 65536 * REG_BR_PROB_BASE / prob;
 
       FOR_EACH_EDGE (c, ei, bb->succs)
       int scale = 65536 * REG_BR_PROB_BASE / prob;
 
       FOR_EACH_EDGE (c, ei, bb->succs)
-       c->probability = (c->probability * scale) / 65536;
+       {
+         c->probability = (c->probability * scale) / 65536;
+         if (c->probability > REG_BR_PROB_BASE)
+           c->probability = REG_BR_PROB_BASE;
+       }
     }
 
   gcc_assert (bb == taken_edge->src);
     }
 
   gcc_assert (bb == taken_edge->src);
@@ -917,6 +921,10 @@ scale_bbs_frequencies_int (basic_block *bbs, int nbbs, int num, int den)
 {
   int i;
   edge e;
 {
   int i;
   edge e;
+  if (num < 0)
+    num = 0;
+  if (num > den)
+    return;
   for (i = 0; i < nbbs; i++)
     {
       edge_iterator ei;
   for (i = 0; i < nbbs; i++)
     {
       edge_iterator ei;
index 305ada6..a448c04 100644 (file)
@@ -1206,7 +1206,7 @@ return_prediction (tree val, enum prediction *prediction)
 static void
 apply_return_prediction (int *heads)
 {
 static void
 apply_return_prediction (int *heads)
 {
-  tree return_stmt;
+  tree return_stmt = NULL;
   tree return_val;
   edge e;
   tree phi;
   tree return_val;
   edge e;
   tree phi;