* [PATCH] Consider also negative edges in cycle detection.
@ 2019-08-30 8:55 Martin Liška
0 siblings, 0 replies; only message in thread
From: Martin Liška @ 2019-08-30 8:55 UTC (permalink / raw)
To: gcc-patches; +Cc: ammy.yi
[-- Attachment #1: Type: text/plain, Size: 577 bytes --]
Hi.
The patch is enhancement of r271117 where I started detecting zero
cycles. We also need consider negative edges.
Patch survives gcov.exp and I'll install it after proper testing
next week.
Thanks,
Martin
gcc/ChangeLog:
2019-08-30 Martin Liska <mliska@suse.cz>
* 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.
---
gcc/gcov.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
[-- Attachment #2: 0001-Consider-also-negative-edges-in-cycle-detection.patch --]
[-- Type: text/x-patch, Size: 1437 bytes --]
diff --git a/gcc/gcov.c b/gcc/gcov.c
index c65b7153765..f4e65ee46da 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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-08-30 8:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30 8:55 [PATCH] Consider also negative edges in cycle detection Martin Liška
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).