* [PATCH] Fix PR87776
@ 2018-10-31 14:51 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2018-10-31 14:51 UTC (permalink / raw)
To: gcc-patches
The following fixes a thinko in the rpo-vn-max-loop-depth param handling.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
Richard.
From 172251b9fdd1ace4c18fb9308be3f4f3ed868241 Mon Sep 17 00:00:00 2001
From: Richard Guenther <rguenther@suse.de>
Date: Wed, 31 Oct 2018 13:33:21 +0100
Subject: [PATCH] fix-pr87776
PR tree-optimization/87776
* tree-ssa-sccvn.c (do_rpo_vn): Do not mark backedges
executable when iterating but running into rpo-vn-max-loop-depth
and not eliding the iteration.
* gcc.dg/torture/pr87776.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/torture/pr87776.c b/gcc/testsuite/gcc.dg/torture/pr87776.c
new file mode 100644
index 00000000000..1f150702dcf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr87776.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-additional-options "--param rpo-vn-max-loop-depth=2" } */
+
+int wp;
+
+void
+ff (void)
+{
+ int *s3 = ℘
+
+ for (wp = 0; wp < 1; ++wp)
+ {
+ if (wp != 0)
+ {
+o8:
+ ;
+ }
+ else
+ {
+b7:
+ while (wp < 1)
+ {
+ }
+ }
+
+ for (*s3 = 0; *s3 < 1; ++*s3)
+ {
+ for (wp = 0; wp < 1; ++wp)
+ for (wp = 0; wp < 1; ++wp)
+ {
+ }
+
+ for (wp = 0; wp < 1; ++wp)
+ goto o8;
+
+ for (wp = 0; wp < 1; ++wp)
+ goto b7;
+ }
+ }
+}
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 38330754769..43641916d52 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -6449,7 +6449,6 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs,
FOR_EACH_EDGE (e, ei, header->preds)
if (e->flags & EDGE_DFS_BACK)
{
- e->flags |= EDGE_EXECUTABLE;
/* There can be a non-latch backedge into the header
which is part of an outer irreducible region. We
cannot avoid iterating this block then. */
@@ -6462,6 +6461,8 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs,
e->src->index, e->dest->index, loop->num);
non_latch_backedge = true;
}
+ else
+ e->flags |= EDGE_EXECUTABLE;
}
rpo_state[bb_to_rpo[header->index]].iterate = non_latch_backedge;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-10-31 14:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31 14:51 [PATCH] Fix PR87776 Richard Biener
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).