diff options
author | Richard Biener <rguenther@suse.de> | 2015-12-01 14:22:40 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-12-01 14:22:40 +0000 |
commit | 2d3f4bf73cdb878c0fee25b962b6a80113d5d80e (patch) | |
tree | 7f5958d775611ca021d5488bb35241a6a29cb6ff | |
parent | bb0d3b5e9b6847783c89cad56ea3d105de21c822 (diff) | |
download | gcc-2d3f4bf73cdb878c0fee25b962b6a80113d5d80e.zip gcc-2d3f4bf73cdb878c0fee25b962b6a80113d5d80e.tar.gz gcc-2d3f4bf73cdb878c0fee25b962b6a80113d5d80e.tar.bz2 |
re PR ada/68590 (FAIL: gnat.dg/loop_optimization19.adb scan-tree-dump-not optimized "Index_Check")
2015-12-01 Richard Biener <rguenther@suse.de>
PR middle-end/68590
* genmatch.c (struct capture_info): Add match_use_count.
(capture_info::walk_match): Increment match_use_count.
(dt_simplify::gen_1): For GENERIC, only wrap multi-use
replacements in a save_expr if they occur more often than
in the original expression.
From-SVN: r231110
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/genmatch.c | 13 |
2 files changed, 18 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f908fe6..79d8d92 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,14 @@ 2015-12-01 Richard Biener <rguenther@suse.de> + PR middle-end/68590 + * genmatch.c (struct capture_info): Add match_use_count. + (capture_info::walk_match): Increment match_use_count. + (dt_simplify::gen_1): For GENERIC, only wrap multi-use + replacements in a save_expr if they occur more often than + in the original expression. + +2015-12-01 Richard Biener <rguenther@suse.de> + PR ipa/68470 * ipa-split.c (split_function): Handle main part not returning. diff --git a/gcc/genmatch.c b/gcc/genmatch.c index 67d1c66..16a4f35 100644 --- a/gcc/genmatch.c +++ b/gcc/genmatch.c @@ -1851,7 +1851,8 @@ struct capture_info bool force_single_use; bool cond_expr_cond_p; unsigned long toplevel_msk; - int result_use_count; + unsigned match_use_count; + unsigned result_use_count; unsigned same_as; capture *c; }; @@ -1901,6 +1902,7 @@ capture_info::walk_match (operand *o, unsigned toplevel_arg, if (capture *c = dyn_cast <capture *> (o)) { unsigned where = c->where; + info[where].match_use_count++; info[where].toplevel_msk |= 1 << toplevel_arg; info[where].force_no_side_effects_p |= conditional_p; info[where].cond_expr_cond_p |= cond_expr_cond_p; @@ -3106,13 +3108,16 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result) else if (is_a <predicate_id *> (opr)) is_predicate = true; /* Search for captures used multiple times in the result expression - and dependent on TREE_SIDE_EFFECTS emit a SAVE_EXPR. */ + and wrap them in a SAVE_EXPR. Allow as many uses as in the + original expression. */ if (!is_predicate) for (int i = 0; i < s->capture_max + 1; ++i) { - if (cinfo.info[i].same_as != (unsigned)i) + if (cinfo.info[i].same_as != (unsigned)i + || cinfo.info[i].cse_p) continue; - if (cinfo.info[i].result_use_count > 1) + if (cinfo.info[i].result_use_count + > cinfo.info[i].match_use_count) fprintf_indent (f, indent, "captures[%d] = save_expr (captures[%d]);\n", i, i); |