aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-09-03 13:28:25 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-09-03 13:28:25 +0000
commit70fc129d86eeeea6f3f04892cec75119ba97b86e (patch)
tree1563fe500213e173d780fd3a853c30d2ad90eb75 /gcc
parentc7a8f93d7b2132ed163a2d80fc06b36792042893 (diff)
downloadgcc-70fc129d86eeeea6f3f04892cec75119ba97b86e.zip
gcc-70fc129d86eeeea6f3f04892cec75119ba97b86e.tar.gz
gcc-70fc129d86eeeea6f3f04892cec75119ba97b86e.tar.bz2
re PR tree-optimization/87197 (ICE in is_gimple_reg_type at gimple-expr.h:75 since r264021)
2018-09-03 Richard Biener <rguenther@suse.de> PR tree-optimization/87197 * tree-ssa-sccvn.c (vn_nary_build_or_lookup_1): Mark the new def visited. CSE the VN_INFO hashtable lookup. * gcc.dg/torture/pr87197.c: New testcase. PR tree-optimization/87169 * tree-ssa-sccvn.c (do_rpo_vn): When marking loops for not iterating make sure there's no extra backedges from irreducible regions feeding the header. Mark the destination block executable. * gcc.dg/torture/pr87169.c: New testcase. From-SVN: r264057
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr87169.c41
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr87197.c35
-rw-r--r--gcc/tree-ssa-sccvn.c30
5 files changed, 120 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1fb40e8..cd3c0e81 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2018-09-03 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/87197
+ * tree-ssa-sccvn.c (vn_nary_build_or_lookup_1): Mark the new def
+ visited. CSE the VN_INFO hashtable lookup.
+
+ PR tree-optimization/87169
+ * tree-ssa-sccvn.c (do_rpo_vn): When marking loops for not
+ iterating make sure there's no extra backedges from irreducible
+ regions feeding the header. Mark the destination block
+ executable.
+
2018-09-03 Martin Liska <mliska@suse.cz>
PR driver/83193
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 89dc377..bd06f66 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2018-09-03 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/87197
+ * gcc.dg/torture/pr87197.c: New testcase.
+
+ PR tree-optimization/87169
+ * gcc.dg/torture/pr87169.c: New testcase.
+
2018-09-03 Martin Liska <mliska@suse.cz>
PR driver/83193
diff --git a/gcc/testsuite/gcc.dg/torture/pr87169.c b/gcc/testsuite/gcc.dg/torture/pr87169.c
new file mode 100644
index 0000000..ed878e0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr87169.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-additional-options "--param rpo-vn-max-loop-depth=7" } */
+
+int a, b, c;
+
+int main ()
+{
+ int d;
+ b = 1;
+L1:
+ for (; b > 1;)
+ goto L2;
+ {
+ int e[1];
+L3:;
+ }
+L2:
+ while (a)
+ {
+ d--;
+ goto L1;
+ }
+ while (c)
+ {
+ if (a)
+ goto L3;
+ if (a)
+ break;
+ if (a)
+ goto L2;
+ while (c)
+ while (c)
+ while (c)
+ while (c)
+ while (c)
+ while (c)
+ while (c)
+ ;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr87197.c b/gcc/testsuite/gcc.dg/torture/pr87197.c
new file mode 100644
index 0000000..4c70224
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr87197.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+
+int a, c, e, f, g;
+void
+h (int i)
+{
+ a = i;
+}
+void
+j (char *i, long k)
+{
+ while (k--)
+ c = *i++;
+}
+void
+l (unsigned char *i, long k)
+{
+ unsigned char *b = i + k;
+ while (i < b)
+ {
+ h (*i);
+ i++;
+ }
+}
+void
+m ()
+{
+ while (e)
+ {
+ float d = g;
+ l ((char *) &d, sizeof (g));
+ if (f)
+ j ((char *) &d, sizeof (g));
+ }
+}
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index c333b89..26d093e 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1783,11 +1783,13 @@ vn_nary_build_or_lookup_1 (gimple_match_op *res_op, bool insert)
/* The expression is not yet available, value-number lhs to
the new SSA_NAME we created. */
/* Initialize value-number information properly. */
- VN_INFO (result)->valnum = result;
- VN_INFO (result)->value_id = get_next_value_id ();
+ vn_ssa_aux_t result_info = VN_INFO (result);
+ result_info->valnum = result;
+ result_info->value_id = get_next_value_id ();
+ result_info->visited = 1;
gimple_seq_add_stmt_without_update (&VN_INFO (result)->expr,
new_stmt);
- VN_INFO (result)->needs_insertion = true;
+ result_info->needs_insertion = true;
/* ??? PRE phi-translation inserts NARYs without corresponding
SSA name result. Re-use those but set their result according
to the stmt we just built. */
@@ -1810,7 +1812,7 @@ vn_nary_build_or_lookup_1 (gimple_match_op *res_op, bool insert)
unsigned int length = vn_nary_length_from_stmt (new_stmt);
vn_nary_op_t vno1
= alloc_vn_nary_op_noinit (length, &vn_tables_insert_obstack);
- vno1->value_id = VN_INFO (result)->value_id;
+ vno1->value_id = result_info->value_id;
vno1->length = length;
vno1->predicated_values = 0;
vno1->u.result = result;
@@ -6360,12 +6362,28 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs,
i < loop_depth (loop) - max_depth; ++i)
{
basic_block header = superloop_at_depth (loop, i)->header;
- rpo_state[bb_to_rpo[header->index]].iterate = false;
+ bool non_latch_backedge = false;
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, header->preds)
if (e->flags & EDGE_DFS_BACK)
- e->flags |= EDGE_EXECUTABLE;
+ {
+ e->flags |= EDGE_EXECUTABLE;
+ e->dest->flags |= BB_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. */
+ if (!dominated_by_p (CDI_DOMINATORS,
+ e->src, e->dest))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "non-latch backedge %d -> %d "
+ "forces iteration of loop %d\n",
+ e->src->index, e->dest->index, loop->num);
+ non_latch_backedge = true;
+ }
+ }
+ rpo_state[bb_to_rpo[header->index]].iterate = non_latch_backedge;
}
}