aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-08-15 11:26:32 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-08-15 11:26:32 +0000
commit204b99cd9c55825cee211ce186b861454a7a4c50 (patch)
tree56252a64a82451901656d11d70af8d6232d07528 /gcc/tree-ssa-sccvn.c
parentc0ff19d57c5fb7c10ca29cd34a8834c4af2ec4fb (diff)
downloadgcc-204b99cd9c55825cee211ce186b861454a7a4c50.zip
gcc-204b99cd9c55825cee211ce186b861454a7a4c50.tar.gz
gcc-204b99cd9c55825cee211ce186b861454a7a4c50.tar.bz2
re PR tree-optimization/81790 (ICE in vn_nary_build_or_lookup_1, at tree-ssa-sccvn.c:1738)
2017-08-15 Richard Biener <rguenther@suse.de> PR tree-optimization/81790 * tree-ssa-sccvn.c (vn_lookup_simplify_result): Handle both CONSTRUCTORs from simplifying and VN. * gcc.dg/torture/pr81790.c: New testcase. From-SVN: r251103
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index d62a49d..19db44a 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1646,13 +1646,25 @@ static unsigned mprts_hook_cnt;
/* Hook for maybe_push_res_to_seq, lookup the expression in the VN tables. */
static tree
-vn_lookup_simplify_result (code_helper rcode, tree type, tree *ops)
+vn_lookup_simplify_result (code_helper rcode, tree type, tree *ops_)
{
if (!rcode.is_tree_code ())
return NULL_TREE;
+ tree *ops = ops_;
+ unsigned int length = TREE_CODE_LENGTH ((tree_code) rcode);
+ if (rcode == CONSTRUCTOR
+ /* ??? We're arriving here with SCCVNs view, decomposed CONSTRUCTOR
+ and GIMPLEs / match-and-simplifies, CONSTRUCTOR as GENERIC tree. */
+ && TREE_CODE (ops_[0]) == CONSTRUCTOR)
+ {
+ length = CONSTRUCTOR_NELTS (ops_[0]);
+ ops = XALLOCAVEC (tree, length);
+ for (unsigned i = 0; i < length; ++i)
+ ops[i] = CONSTRUCTOR_ELT (ops_[0], i)->value;
+ }
vn_nary_op_t vnresult = NULL;
- tree res = vn_nary_op_lookup_pieces (TREE_CODE_LENGTH ((tree_code) rcode),
- (tree_code) rcode, type, ops, &vnresult);
+ tree res = vn_nary_op_lookup_pieces (length, (tree_code) rcode,
+ type, ops, &vnresult);
/* We can end up endlessly recursing simplifications if the lookup above
presents us with a def-use chain that mirrors the original simplification.
See PR80887 for an example. Limit successful lookup artificially