]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport r275291
authorMartin Liska <mliska@suse.cz>
Mon, 2 Sep 2019 08:58:17 +0000 (10:58 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 2 Sep 2019 08:58:17 +0000 (08:58 +0000)
2019-09-02  Martin Liska  <mliska@suse.cz>

Backport from mainline
2019-09-02  Martin Liska  <mliska@suse.cz>

PR gcov-profile/91601
* gcov.c (path_contains_zero_cycle_arc): Rename to ...
(path_contains_zero_or_negative_cycle_arc): ... this and handle
also negative edges.
(circuit): Handle also negative edges as they can happen
in some situations.

From-SVN: r275301

gcc/ChangeLog
gcc/gcov.c

index 195aa66e6e04ce600c80c9b562312b4d905af0dc..569691bbb2cd50a1957a2c419cbb6b89582adc20 100644 (file)
@@ -1,3 +1,15 @@
+2019-09-02  Martin Liska  <mliska@suse.cz>
+
+       Backport from mainline
+       2019-09-02  Martin Liska  <mliska@suse.cz>
+
+       PR gcov-profile/91601
+       * gcov.c (path_contains_zero_cycle_arc): Rename to ...
+       (path_contains_zero_or_negative_cycle_arc): ... this and handle
+       also negative edges.
+       (circuit): Handle also negative edges as they can happen
+       in some situations.
+
 2019-09-01  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR target/91472
index b06a6714c2e5b2af4d7d24d5fcf201898e4c7768..7e51c2efb30a4fe010c2aec217b88d949b902cf8 100644 (file)
@@ -725,10 +725,10 @@ unblock (const block_info *u, block_vector_t &blocked,
 /* Return true when PATH contains a zero cycle arc count.  */
 
 static bool
-path_contains_zero_cycle_arc (arc_vector_t &path)
+path_contains_zero_or_negative_cycle_arc (arc_vector_t &path)
 {
   for (unsigned i = 0; i < path.size (); i++)
-    if (path[i]->cs_count == 0)
+    if (path[i]->cs_count <= 0)
       return true;
   return false;
 }
@@ -754,7 +754,7 @@ circuit (block_info *v, arc_vector_t &path, block_info *start,
     {
       block_info *w = arc->dst;
       if (w < start
-         || arc->cs_count == 0
+         || arc->cs_count <= 0
          || !linfo.has_block (w))
        continue;
 
@@ -765,7 +765,7 @@ circuit (block_info *v, arc_vector_t &path, block_info *start,
          handle_cycle (path, count);
          loop_found = true;
        }
-      else if (!path_contains_zero_cycle_arc (path)
+      else if (!path_contains_zero_or_negative_cycle_arc (path)
               &&  find (blocked.begin (), blocked.end (), w) == blocked.end ())
        loop_found |= circuit (w, path, start, blocked, block_lists, linfo,
                               count);
@@ -780,7 +780,7 @@ circuit (block_info *v, arc_vector_t &path, block_info *start,
       {
        block_info *w = arc->dst;
        if (w < start
-           || arc->cs_count == 0
+           || arc->cs_count <= 0
            || !linfo.has_block (w))
          continue;