aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-09-12 12:14:27 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-09-12 12:14:27 +0000
commit28c4b740a64ccc3412ef4c01e3012e9013ad5bcb (patch)
tree23d4dadbe109d288896bf34415de7f06aa27d124 /gcc
parentced8d882349226b8c566914826e8f59961240ad1 (diff)
downloadgcc-28c4b740a64ccc3412ef4c01e3012e9013ad5bcb.zip
gcc-28c4b740a64ccc3412ef4c01e3012e9013ad5bcb.tar.gz
gcc-28c4b740a64ccc3412ef4c01e3012e9013ad5bcb.tar.bz2
re PR tree-optimization/87266 (ICE: Segmentation fault (in useless_type_conversion_p, tree_nop_conversion_p, or is_gimple_reg_type))
2018-09-12 Richard Biener <rguenther@suse.de> PR tree-optimization/87266 * tree-ssa-sccvn.c (do_rpo_vn): Always iterate to not yet visited blocks. * gcc.dg/torture/pr87266-1.c: New testcase. * gcc.dg/torture/pr87266-2.c: Likewise. * gcc.dg/torture/pr87266-3.c: Likewise. * gcc.dg/torture/pr87266-4.c: Likewise. From-SVN: r264237
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr87266-1.c32
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr87266-2.c32
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr87266-3.c32
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr87266-4.c38
-rw-r--r--gcc/tree-ssa-sccvn.c12
7 files changed, 159 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 77ef4bb..c96b5eb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2018-09-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/87266
+ * tree-ssa-sccvn.c (do_rpo_vn): Always iterate to not yet
+ visited blocks.
+
2018-09-12 Andreas Krebbel <krebbel@linux.ibm.com>
* config/s390/s390.md (PFPO_RND_MODE_DFP, PFPO_RND_MODE_BFP): New
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a29d014..5f73cd8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2018-09-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/87266
+ * gcc.dg/torture/pr87266-1.c: New testcase.
+ * gcc.dg/torture/pr87266-2.c: Likewise.
+ * gcc.dg/torture/pr87266-3.c: Likewise.
+ * gcc.dg/torture/pr87266-4.c: Likewise.
+
2018-09-12 Andreas Krebbel <krebbel@linux.ibm.com>
* gcc.target/s390/dfp_to_bfp_rounding.c: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/pr87266-1.c b/gcc/testsuite/gcc.dg/torture/pr87266-1.c
new file mode 100644
index 0000000..dc0a4a1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr87266-1.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-ccp -fno-tree-forwprop" } */
+
+void
+iw (int gu, int mq, int r2)
+{
+ int yn = 0;
+
+ while (gu < 1)
+ {
+ for (;;)
+ ;
+
+ bb:;
+ int ay = 0;
+
+ while (ay < 1)
+ ++mq;
+ }
+
+ if (yn != 0)
+ goto up;
+
+ if (0)
+ {
+ up:
+ if (r2 == 0)
+ goto bb;
+ }
+
+ goto up;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr87266-2.c b/gcc/testsuite/gcc.dg/torture/pr87266-2.c
new file mode 100644
index 0000000..cf0254f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr87266-2.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-ccp -fno-tree-forwprop" } */
+
+void
+iw (int gu, int mq, int r2)
+{
+ int yn = 0;
+
+ while (gu < 1)
+ {
+ for (;;)
+ ;
+
+ bb:;
+ int ay = 0;
+
+ while (yn < 1)
+ ++mq;
+ }
+
+ if (yn != 0)
+ goto up;
+
+ if (0)
+ {
+ up:
+ if (r2 == 0)
+ goto bb;
+ }
+
+ goto up;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr87266-3.c b/gcc/testsuite/gcc.dg/torture/pr87266-3.c
new file mode 100644
index 0000000..0f3f3ba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr87266-3.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-ccp -fno-tree-forwprop" } */
+
+void
+iw (int gu, int mq, int r2)
+{
+ int yn = 0;
+
+ while (gu < 1)
+ {
+ int ay = 0;
+
+ for (;;)
+ ;
+
+ bb:
+ while (ay < 1)
+ ++mq;
+ }
+
+ if (yn != 0)
+ goto up;
+
+ if (0)
+ {
+ up:
+ if (r2 == 0)
+ goto bb;
+ }
+
+ goto up;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr87266-4.c b/gcc/testsuite/gcc.dg/torture/pr87266-4.c
new file mode 100644
index 0000000..e8d5ff1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr87266-4.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-dominator-opts -fno-tree-forwprop" } */
+
+unsigned long int
+re (long int j9)
+{
+ if (j9 == 0)
+ return 1;
+
+ return j9;
+}
+
+void
+zq (int bt, int yy)
+{
+ int p3 = 0, go = 4, ez = go;
+
+ while (go != 0)
+ {
+ if (ez + !!bt - re (bt) != 0 && go != 0)
+ {
+ if (yy != 0)
+ p3 = yy;
+ }
+ else
+ return;
+
+ go = 2;
+ }
+}
+
+void
+my (unsigned long int n6, int bt, int yy)
+{
+ zq (bt, yy);
+ n6 = n6 == bt;
+ zq (bt, yy);
+}
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 6fec624..8bf724e 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -6471,6 +6471,17 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs,
== (EDGE_DFS_BACK|EDGE_EXECUTABLE)
&& rpo_state[bb_to_rpo[e->dest->index]].iterate)
{
+ int destidx = bb_to_rpo[e->dest->index];
+ if (!rpo_state[destidx].visited)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Unvisited destination %d\n",
+ e->dest->index);
+ if (iterate_to == -1
+ || destidx < iterate_to)
+ iterate_to = destidx;
+ continue;
+ }
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Looking for changed values of backedge "
"%d->%d destination PHIs\n",
@@ -6497,7 +6508,6 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs,
&& dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "PHI was CSEd and hashtable "
"state (changed)\n");
- int destidx = bb_to_rpo[e->dest->index];
if (iterate_to == -1
|| destidx < iterate_to)
iterate_to = destidx;