aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-fold.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-10-01 07:54:26 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-10-01 07:54:26 +0000
commit34050b6bee181a12099a9bc31a4d25469573bc6d (patch)
tree84b464b97cc715dd2e30f73f4fc420d296b60500 /gcc/gimple-fold.c
parente01c66ca3083cf998d7e2f568ff6227f86727499 (diff)
downloadgcc-34050b6bee181a12099a9bc31a4d25469573bc6d.zip
gcc-34050b6bee181a12099a9bc31a4d25469573bc6d.tar.gz
gcc-34050b6bee181a12099a9bc31a4d25469573bc6d.tar.bz2
gimple-match.h (mprts_hook): Declare.
2015-10-01 Richard Biener <rguenther@suse.de> * gimple-match.h (mprts_hook): Declare. * gimple-match.head.c (mprts_hook): Define. (maybe_push_res_to_seq): Use new hook. * gimple-fold.c (gimple_fold_stmt_to_constant_1): Likewise. * tree-ssa-sccvn.h (vn_ssa_aux::expr): Change to a gimple_seq. (vn_ssa_aux::has_constants): Remove. * tree-ssa-sccvn.c: Include gimple-match.h. (VN_INFO_GET): Assert we don't re-use SSA names. (vn_get_expr_for): Remove. (expr_has_constants): Likewise. (stmt_has_constants): Likewise. (simplify_binary_expression): Likewise. (simplify_unary_expression): Likewise. (vn_lookup_simplify_result): New hook. (visit_copy): Adjust. (visit_reference_op_call): Likewise. (visit_phi): Likewise. (visit_use): Likewise. (process_scc): Likewise. (init_scc_vn): Likewise. (visit_reference_op_load): Likewise. Use match-and-simplify and a gimple seq for inserted expressions. (try_to_simplify): Remove GENERIC stmt combining code. (sccvn_dom_walker::before_dom_children): Use match-and-simplify. * tree-ssa-pre.c (eliminate_insert): Adjust. (eliminate_dom_walker::before_dom_children): Likewise. * gcc.dg/tree-ssa/ssa-fre-7.c: Adjust. * gcc.dg/tree-ssa/ssa-fre-8.c: Likewise. From-SVN: r228320
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r--gcc/gimple-fold.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 51309f2..9f5e4e9 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -4877,22 +4877,28 @@ gimple_fold_stmt_to_constant_1 (gimple *stmt, tree (*valueize) (tree),
edges if there are intermediate VARYING defs. For this reason
do not follow SSA edges here even though SCCVN can technically
just deal fine with that. */
- if (gimple_simplify (stmt, &rcode, ops, NULL, gvalueize, valueize)
- && rcode.is_tree_code ()
- && (TREE_CODE_LENGTH ((tree_code) rcode) == 0
- || ((tree_code) rcode) == ADDR_EXPR)
- && is_gimple_val (ops[0]))
- {
- tree res = ops[0];
- if (dump_file && dump_flags & TDF_DETAILS)
+ if (gimple_simplify (stmt, &rcode, ops, NULL, gvalueize, valueize))
+ {
+ tree res = NULL_TREE;
+ if (rcode.is_tree_code ()
+ && (TREE_CODE_LENGTH ((tree_code) rcode) == 0
+ || ((tree_code) rcode) == ADDR_EXPR)
+ && is_gimple_val (ops[0]))
+ res = ops[0];
+ else if (mprts_hook)
+ res = mprts_hook (rcode, gimple_expr_type (stmt), ops);
+ if (res)
{
- fprintf (dump_file, "Match-and-simplified ");
- print_gimple_expr (dump_file, stmt, 0, TDF_SLIM);
- fprintf (dump_file, " to ");
- print_generic_expr (dump_file, res, 0);
- fprintf (dump_file, "\n");
+ if (dump_file && dump_flags & TDF_DETAILS)
+ {
+ fprintf (dump_file, "Match-and-simplified ");
+ print_gimple_expr (dump_file, stmt, 0, TDF_SLIM);
+ fprintf (dump_file, " to ");
+ print_generic_expr (dump_file, res, 0);
+ fprintf (dump_file, "\n");
+ }
+ return res;
}
- return res;
}
location_t loc = gimple_location (stmt);