cfg.c (update_bb_profile_for_threading): More diagnostic.
authorJan Hubicka <jh@suse.cz>
Fri, 15 Jul 2005 09:46:17 +0000 (11:46 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Fri, 15 Jul 2005 09:46:17 +0000 (09:46 +0000)
* cfg.c (update_bb_profile_for_threading): More diagnostic.
* tree-ssa-threadupdate.c (redirect_edges): Update profile of dup_block.

From-SVN: r102053

gcc/ChangeLog
gcc/cfg.c
gcc/tree-ssa-threadupdate.c

index 317e2d75f11a633a32b2fdfdeaba9d46efa4471f..525ad008bb203951c3c23c100ddb39377e21e3c2 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-15  Jan Hubicka  <jh@suse.cz>
+
+       * cfg.c (update_bb_profile_for_threading): More diagnostic.
+       * tree-ssa-threadupdate.c (redirect_edges): Update profile of dup_block.
+
 2005-07-15  Richard Guenther  <rguenther@suse.de>
 
        * c-common.c (handle_flatten_attribute): New function.
index 2d6a3ca5c33647e212ddb82fdcdda0bcf5b5cdd6..6aeb79417f992b323725ceacafd45b2294b70a79 100644 (file)
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -850,7 +850,12 @@ update_bb_profile_for_threading (basic_block bb, int edge_frequency,
 
   bb->count -= count;
   if (bb->count < 0)
-    bb->count = 0;
+    {
+      if (dump_file)
+       fprintf (dump_file, "bb %i count became negative after threading",
+                bb->index);
+      bb->count = 0;
+    }
 
   /* Compute the probability of TAKEN_EDGE being reached via threaded edge.
      Watch for overflows.  */
@@ -897,7 +902,12 @@ update_bb_profile_for_threading (basic_block bb, int edge_frequency,
   gcc_assert (bb == taken_edge->src);
   taken_edge->count -= count;
   if (taken_edge->count < 0)
-    taken_edge->count = 0;
+    {
+      if (dump_file)
+       fprintf (dump_file, "edge %i->%i count became negative after threading",
+                taken_edge->src->index, taken_edge->dest->index);
+      taken_edge->count = 0;
+    }
 }
 
 /* Multiply all frequencies of basic blocks in array BBS of length NBBS
index a89a438f6301b085c8b2356f22ac81a0dae90e41..6181b27978d65a4dd31a3fb3191c0c1e0f765bda 100644 (file)
@@ -609,6 +609,9 @@ redirect_edges (void **slot, void *data)
            fprintf (dump_file, "  Threaded jump %d --> %d to %d\n",
                     e->src->index, e->dest->index, rd->dup_block->index);
 
+         rd->dup_block->count += e->count;
+         rd->dup_block->frequency += EDGE_FREQUENCY (e);
+         EDGE_SUCC (rd->dup_block, 0)->count += e->count;
          /* Redirect the incoming edge to the appropriate duplicate
             block.  */
          e2 = redirect_edge_and_branch (e, rd->dup_block);