aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
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/tree-ssa-sccvn.c
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/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c30
1 files changed, 24 insertions, 6 deletions
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;
}
}