bb-reorder.c (make_reorder_chain_1): Protect against when redundant edges are omitted.
authorDJ Delorie <dj@redhat.com>
Fri, 22 Mar 2002 02:50:15 +0000 (21:50 -0500)
committerDJ Delorie <dj@gcc.gnu.org>
Fri, 22 Mar 2002 02:50:15 +0000 (21:50 -0500)
* bb-reorder.c (make_reorder_chain_1): Protect against
when redundant edges are omitted.
* predict.c (dump_prediction): Likewise.

From-SVN: r51160

gcc/ChangeLog
gcc/bb-reorder.c
gcc/predict.c

index bbdadd7effc13fc9fefe8b92a93aa4358f5c1466..a9753047c9989ae314887569dc5bd7360b3c7626 100644 (file)
@@ -1,3 +1,9 @@
+2002-03-21  DJ Delorie  <dj@redhat.com>
+
+       * bb-reorder.c (make_reorder_chain_1): Protect against
+       when redundant edges are omitted.
+       * predict.c (dump_prediction): Likewise.
+
 2002-03-21  Richard Henderson  <rth@redhat.com>
 
        PR target/5996
index 2578604889ec59ca76be6d57b19c7b0db0b67b43..3647ad6ec4b45dfcecdf47ab0bf56b2395a3cf6d 100644 (file)
@@ -205,7 +205,7 @@ make_reorder_chain_1 (bb, prev)
            e_taken = e;
        }
 
-      next = (taken ? e_taken : e_fall)->dest;
+      next = ((taken && e_taken) ? e_taken : e_fall)->dest;
     }
 
   /* In the absence of a prediction, disturb things as little as possible
index 61cfd63cd7c2166f6cd62b0a026d7d4e9d32dbcb..56b04365b3f7dbe1aeaf3ed5383b0a75260ae215 100644 (file)
@@ -194,7 +194,7 @@ dump_prediction (predictor, probability, bb, used)
   if (!rtl_dump_file)
     return;
 
-  while (e->flags & EDGE_FALLTHRU)
+  while (e && (e->flags & EDGE_FALLTHRU))
     e = e->succ_next;
 
   fprintf (rtl_dump_file, "  %s heuristics%s: %.1f%%",
@@ -205,9 +205,12 @@ dump_prediction (predictor, probability, bb, used)
     {
       fprintf (rtl_dump_file, "  exec ");
       fprintf (rtl_dump_file, HOST_WIDEST_INT_PRINT_DEC, bb->count);
-      fprintf (rtl_dump_file, " hit ");
-      fprintf (rtl_dump_file, HOST_WIDEST_INT_PRINT_DEC, e->count);
-      fprintf (rtl_dump_file, " (%.1f%%)", e->count * 100.0 / bb->count);
+      if (e)
+       {
+         fprintf (rtl_dump_file, " hit ");
+         fprintf (rtl_dump_file, HOST_WIDEST_INT_PRINT_DEC, e->count);
+         fprintf (rtl_dump_file, " (%.1f%%)", e->count * 100.0 / bb->count);
+       }
     }
 
   fprintf (rtl_dump_file, "\n");