predict.c (determine_unlikely_bbs): Handle correctly BBs which appears in the queue...
authorJan Hubicka <hubicka@ucw.cz>
Sat, 13 Jan 2018 19:32:04 +0000 (20:32 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 13 Jan 2018 19:32:04 +0000 (19:32 +0000)
* predict.c (determine_unlikely_bbs): Handle correctly BBs
which appears in the queue multiple times.

From-SVN: r256648

gcc/ChangeLog
gcc/predict.c

index 37656fa68aeb2db542e49e3425198fb17df2cc68..bcc77eb28d9e03a69880d34695275aa35f427749 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-13  Jan Hubicka  <hubicka@ucw.cz>
+
+       * predict.c (determine_unlikely_bbs): Handle correctly BBs
+       which appears in the queue multiple times.
+
 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index b6be32d48bc2fe87e273e45fdfc3656e118e53e9..4c1e4489b55db8fdd1624ed41cc1ed160b8fa9a6 100644 (file)
@@ -3565,6 +3565,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 +3585,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 +3595,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);