diff options
author | Richard Biener <rguenther@suse.de> | 2017-02-28 15:32:24 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-02-28 15:32:24 +0000 |
commit | 41aa3a38572bd643ae958fb23a9fad87cdddd9bb (patch) | |
tree | dbbfdd34b9627de77f02682c0884df4ffbfa6a56 /gcc/tree-ssa-sccvn.c | |
parent | 587240d2494dae65fd67d5bd642a6123ecc89738 (diff) | |
download | gcc-41aa3a38572bd643ae958fb23a9fad87cdddd9bb.zip gcc-41aa3a38572bd643ae958fb23a9fad87cdddd9bb.tar.gz gcc-41aa3a38572bd643ae958fb23a9fad87cdddd9bb.tar.bz2 |
re PR tree-optimization/79740 (ICE on -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in VN_INFO_GET, at tree-ssa-sccvn.c:407 }))
2017-02-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/79740
* tree-ssa-sccvn.c (vn_nary_op_insert_into): Allow redundant
inserts.
(visit_nary_op): Insert the nary into the hashtable if we
pattern-matched sth.
* tree-ssa-pre.c (eliminate_insert): Robustify.
* gcc.dg/torture/pr79740.c: New testcase.
From-SVN: r245780
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 4f5e852..e7502de 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2820,6 +2820,15 @@ vn_nary_op_insert_into (vn_nary_op_t vno, vn_nary_op_table_type *table, vno->hashcode = vn_nary_op_compute_hash (vno); slot = table->find_slot_with_hash (vno, vno->hashcode, INSERT); + /* While we do not want to insert things twice it's awkward to + avoid it in the case where visit_nary_op pattern-matches stuff + and ends up simplifying the replacement to itself. We then + get two inserts, one from visit_nary_op and one from + vn_nary_build_or_lookup. + So allow inserts with the same value number. */ + if (*slot && (*slot)->result == vno->result) + return *slot; + gcc_assert (!*slot); *slot = vno; @@ -3544,7 +3553,11 @@ visit_nary_op (tree lhs, gassign *stmt) result = vn_nary_build_or_lookup (NOP_EXPR, type, ops); if (result) - return set_ssa_val_to (lhs, result); + { + bool changed = set_ssa_val_to (lhs, result); + vn_nary_op_insert_stmt (stmt, result); + return changed; + } } else { @@ -3555,7 +3568,11 @@ visit_nary_op (tree lhs, gassign *stmt) TREE_TYPE (lhs), ops); if (result) - return set_ssa_val_to (lhs, result); + { + bool changed = set_ssa_val_to (lhs, result); + vn_nary_op_insert_stmt (stmt, result); + return changed; + } } } } |