hi,
this patch fixes bug in backward propagation where some BBs can be marked
unlikely for incorrect reason.

Bootstrapped/regtested x86_64-linux,comitted.

Honza

        * predict.c (determine_unlikely_bbs): Handle correctly BBs
        which appears in the queue multiple times.

Index: predict.c
===================================================================
--- predict.c   (revision 256604)
+++ predict.c   (working copy)
@@ -3565,6 +3566,8 @@ determine_unlikely_bbs ()
   while (worklist.length () > 0)
     {
       bb = worklist.pop ();
+      if (bb->count == profile_count::zero ())
+       continue;
       if (bb != ENTRY_BLOCK_PTR_FOR_FN (cfun))
        {
          bool found = false;
@@ -3583,8 +3586,7 @@ determine_unlikely_bbs ()
          if (found)
            continue;
        }
-      if (!(bb->count == profile_count::zero ())
-         && (dump_file && (dump_flags & TDF_DETAILS)))
+      if (dump_file && (dump_flags & TDF_DETAILS))
        fprintf (dump_file,
                 "Basic block %i is marked unlikely by backward prop\n",
                 bb->index);
@@ -3594,6 +3596,7 @@ determine_unlikely_bbs ()
          {
            if (!(e->src->count == profile_count::zero ()))
              {
+               gcc_checking_assert (nsuccs[e->src->index] > 0);
                nsuccs[e->src->index]--;
                if (!nsuccs[e->src->index])
                  worklist.safe_push (e->src);

Reply via email to