diff options
author | Richard Biener <rguenther@suse.de> | 2018-07-12 07:08:34 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2018-07-12 07:08:34 +0000 |
commit | 19353855bfc05914faaee9f297684f608fd9a485 (patch) | |
tree | 5efac508c9b97fdcd24bad7d09b0a091e2dae779 /gcc/gimple-match-head.c | |
parent | 2c81daeeb5456d3b588e2ad22b5ec098bea2d393 (diff) |
tree-ssa-sccvn.c (mprts_hook_cnt): Remove.
2018-07-12 Richard Biener <rguenther@suse.de>
* tree-ssa-sccvn.c (mprts_hook_cnt): Remove.
(vn_lookup_simplify_result): Remove recursion limit applied
here.
(vn_nary_build_or_lookup_1): Adjust.
(try_to_simplify): Likewise.
* gimple-match-head.c (gimple_resimplify1): Instead apply one
here.
(gimple_resimplify2): Likewise.
(gimple_resimplify3): Likewise.
(gimple_resimplify4): Likewise.
From-SVN: r262573
Diffstat (limited to 'gcc/gimple-match-head.c')
-rw-r--r-- | gcc/gimple-match-head.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c index 1a12bb35e01..c5a19239798 100644 --- a/gcc/gimple-match-head.c +++ b/gcc/gimple-match-head.c @@ -97,13 +97,30 @@ gimple_resimplify1 (gimple_seq *seq, gimple_match_op *res_op, } } + /* Limit recursion, there are cases like PR80887 and others, for + example when value-numbering presents us with unfolded expressions + that we are really not prepared to handle without eventual + oscillation like ((_50 + 0) + 8) where _50 gets mapped to _50 + itself as available expression. */ + static unsigned depth; + if (depth > 10) + { + if (dump_file && (dump_flags & TDF_FOLDING)) + fprintf (dump_file, "Aborting expression simplification due to " + "deep recursion\n"); + return false; + } + + ++depth; gimple_match_op res_op2 (*res_op); if (gimple_simplify (&res_op2, seq, valueize, res_op->code, res_op->type, res_op->ops[0])) { + --depth; *res_op = res_op2; return true; } + --depth; return false; } @@ -151,14 +168,27 @@ gimple_resimplify2 (gimple_seq *seq, gimple_match_op *res_op, canonicalized = true; } + /* Limit recursion, see gimple_resimplify1. */ + static unsigned depth; + if (depth > 10) + { + if (dump_file && (dump_flags & TDF_FOLDING)) + fprintf (dump_file, "Aborting expression simplification due to " + "deep recursion\n"); + return false; + } + + ++depth; gimple_match_op res_op2 (*res_op); if (gimple_simplify (&res_op2, seq, valueize, res_op->code, res_op->type, res_op->ops[0], res_op->ops[1])) { + --depth; *res_op = res_op2; return true; } + --depth; return canonicalized; } @@ -205,14 +235,27 @@ gimple_resimplify3 (gimple_seq *seq, gimple_match_op *res_op, canonicalized = true; } + /* Limit recursion, see gimple_resimplify1. */ + static unsigned depth; + if (depth > 10) + { + if (dump_file && (dump_flags & TDF_FOLDING)) + fprintf (dump_file, "Aborting expression simplification due to " + "deep recursion\n"); + return false; + } + + ++depth; gimple_match_op res_op2 (*res_op); if (gimple_simplify (&res_op2, seq, valueize, res_op->code, res_op->type, res_op->ops[0], res_op->ops[1], res_op->ops[2])) { + --depth; *res_op = res_op2; return true; } + --depth; return canonicalized; } @@ -229,15 +272,28 @@ gimple_resimplify4 (gimple_seq *seq, gimple_match_op *res_op, { /* No constant folding is defined for four-operand functions. */ + /* Limit recursion, see gimple_resimplify1. */ + static unsigned depth; + if (depth > 10) + { + if (dump_file && (dump_flags & TDF_FOLDING)) + fprintf (dump_file, "Aborting expression simplification due to " + "deep recursion\n"); + return false; + } + + ++depth; gimple_match_op res_op2 (*res_op); if (gimple_simplify (&res_op2, seq, valueize, res_op->code, res_op->type, res_op->ops[0], res_op->ops[1], res_op->ops[2], res_op->ops[3])) { + --depth; *res_op = res_op2; return true; } + --depth; return false; } |