On Thu, 12 Jul 2018, Richard Biener wrote: > > This moves a recursion limit installed for PR80887 from > vn_lookup_simplify_result to gimple_resimplify* where it also applies > to a testcase I'm running into with modified VN without ever > calling vn_lookup_simplify_result. Basically with VN we are > not presenting the match.pd patterns with simplified expressions > but for example we happily feed it ((_50 + 0) + 8) via valueization > of def-stmt operands. With the correct IL setup it can easily > happen that _50 is a leader for itself, thus with _50 = _2 + _3; > it is value-numbered as a copy but the value doesn't have a leader > here so _50 becomes the leader. This effectively turns it into > _50 = _50; > > Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
And I was too lazy in simplifying vn_lookup_simplify_result. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2018-07-12 Richard Biener <rguent...@suse.de> * tree-ssa-sccvn.c (vn_lookup_simplify_result): Remove bogus left-over from last patch. Index: gcc/tree-ssa-sccvn.c =================================================================== --- gcc/tree-ssa-sccvn.c (revision 262577) +++ gcc/tree-ssa-sccvn.c (working copy) @@ -1669,17 +1669,8 @@ vn_lookup_simplify_result (gimple_match_ ops[i] = CONSTRUCTOR_ELT (res_op->ops[0], i)->value; } vn_nary_op_t vnresult = NULL; - tree res = vn_nary_op_lookup_pieces (length, (tree_code) res_op->code, - res_op->type, ops, &vnresult); - if (res - && mprts_hook) - { - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "Resetting mprts_hook after too many " - "invocations.\n"); - mprts_hook = NULL; - } - return res; + return vn_nary_op_lookup_pieces (length, (tree_code) res_op->code, + res_op->type, ops, &vnresult); } /* Return a value-number for RCODE OPS... either by looking up an existing