diff options
author | Richard Biener <rguenther@suse.de> | 2016-05-12 13:46:26 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-05-12 13:46:26 +0000 |
commit | 1ef33ef304cedbeca446e79d677cd18036a5dc66 (patch) | |
tree | 08146efd808e84c14b2bdd4c476c5540b75f9f33 /gcc/tree-ssa-sccvn.c | |
parent | 763baff6f54ec6070e0ec6497363f5116ab4c874 (diff) | |
download | gcc-1ef33ef304cedbeca446e79d677cd18036a5dc66.zip gcc-1ef33ef304cedbeca446e79d677cd18036a5dc66.tar.gz gcc-1ef33ef304cedbeca446e79d677cd18036a5dc66.tar.bz2 |
re PR tree-optimization/71059 (gcc ICE at -O3 on valid code on x86_64-linux-gnu in "vn_nary_op_insert_into")
2016-05-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/71059
* tree-ssa-pre.c (phi_translate_1): Fully fold translated
nary before looking up or entering the expression into the VN
hashes.
* tree-ssa-sccvn.c (vn_nary_build_or_lookup): Fix comment typo.
Make sure to re-use NARYs without result as inserted by
phi-translation.
* gcc.dg/torture/pr71059.c: New testcase.
From-SVN: r236175
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 1567fb9..730db04 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -1632,7 +1632,7 @@ vn_nary_build_or_lookup (code_helper rcode, tree type, tree *ops) { tree result = NULL_TREE; /* We will be creating a value number for - ROCDE (OPS...). + RCODE (OPS...). So first simplify and lookup this expression to see if it is already available. */ mprts_hook = vn_lookup_simplify_result; @@ -1682,6 +1682,16 @@ vn_nary_build_or_lookup (code_helper rcode, tree type, tree *ops) gimple_seq_add_stmt_without_update (&VN_INFO (result)->expr, new_stmt); VN_INFO (result)->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. */ + vn_nary_op_t nary = NULL; + vn_nary_op_lookup_stmt (new_stmt, &nary); + if (nary) + { + gcc_assert (nary->result == NULL_TREE); + nary->result = gimple_assign_lhs (new_stmt); + } /* As all "inserted" statements are singleton SCCs, insert to the valid table. This is strictly needed to avoid re-generating new value SSA_NAMEs for the same @@ -1689,7 +1699,7 @@ vn_nary_build_or_lookup (code_helper rcode, tree type, tree *ops) optimistic table gets cleared after each iteration). We do not need to insert into the optimistic table, as lookups there will fall back to the valid table. */ - if (current_info == optimistic_info) + else if (current_info == optimistic_info) { current_info = valid_info; vn_nary_op_insert_stmt (new_stmt, result); |