Commit 9297e013 by Martin Liska Committed by Martin Liska

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
parent ea323e9e
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> 2019-09-01 Eric Botcazou <ebotcazou@adacore.com>
PR target/91472 PR target/91472
......
...@@ -730,10 +730,10 @@ unblock (const block_info *u, block_vector_t &blocked, ...@@ -730,10 +730,10 @@ unblock (const block_info *u, block_vector_t &blocked,
/* Return true when PATH contains a zero cycle arc count. */ /* Return true when PATH contains a zero cycle arc count. */
static bool 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++) for (unsigned i = 0; i < path.size (); i++)
if (path[i]->cs_count == 0) if (path[i]->cs_count <= 0)
return true; return true;
return false; return false;
} }
...@@ -759,7 +759,7 @@ circuit (block_info *v, arc_vector_t &path, block_info *start, ...@@ -759,7 +759,7 @@ circuit (block_info *v, arc_vector_t &path, block_info *start,
{ {
block_info *w = arc->dst; block_info *w = arc->dst;
if (w < start if (w < start
|| arc->cs_count == 0 || arc->cs_count <= 0
|| !linfo.has_block (w)) || !linfo.has_block (w))
continue; continue;
...@@ -770,7 +770,7 @@ circuit (block_info *v, arc_vector_t &path, block_info *start, ...@@ -770,7 +770,7 @@ circuit (block_info *v, arc_vector_t &path, block_info *start,
handle_cycle (path, count); handle_cycle (path, count);
loop_found = true; 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 ()) && find (blocked.begin (), blocked.end (), w) == blocked.end ())
loop_found |= circuit (w, path, start, blocked, block_lists, linfo, loop_found |= circuit (w, path, start, blocked, block_lists, linfo,
count); count);
...@@ -785,7 +785,7 @@ circuit (block_info *v, arc_vector_t &path, block_info *start, ...@@ -785,7 +785,7 @@ circuit (block_info *v, arc_vector_t &path, block_info *start,
{ {
block_info *w = arc->dst; block_info *w = arc->dst;
if (w < start if (w < start
|| arc->cs_count == 0 || arc->cs_count <= 0
|| !linfo.has_block (w)) || !linfo.has_block (w))
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment