aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcov.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-09-02 09:06:54 +0200
committerMartin Liska <marxin@gcc.gnu.org>2019-09-02 07:06:54 +0000
commit9297e013293e4d332fc7c40859ea4dd9616e0d88 (patch)
tree8b7389e6558c35f4068d435a5cce1f78cf8ad231 /gcc/gcov.c
parentea323e9e926409ea4ea6317d81255b43020e4f1c (diff)
downloadgcc-9297e013293e4d332fc7c40859ea4dd9616e0d88.zip
gcc-9297e013293e4d332fc7c40859ea4dd9616e0d88.tar.gz
gcc-9297e013293e4d332fc7c40859ea4dd9616e0d88.tar.bz2
Consider also negative edges in cycle detection.
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: r275291
Diffstat (limited to 'gcc/gcov.c')
-rw-r--r--gcc/gcov.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/gcov.c b/gcc/gcov.c
index c65b715..f4e65ee 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -730,10 +730,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;
}
@@ -759,7 +759,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;
@@ -770,7 +770,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);
@@ -785,7 +785,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;