This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][match-and-simplify] s/match_and_simplify/simplify/


This replaces match_and_simplify with just 'simplify' everywhere,
in patterns and API.  It's shorter and as descriptive.

This also pushes two minor changes to not use APIs I consider
internal from SCCVN or forwprop.

Committed.

Richard.

2014-08-05  Richard Biener  <rguenther@suse.de>

	* doc/match-and-simplify.texi: s/match_and_simplify/simplify/g
	* fold-const.c: Likewise.
	* genmatch.c: Likewise.
	* gimple-fold.c: Likewise.
	* gimple-fold.h: Likewise.
	* gimple-match-head.c: Likewise.
	* match-bitwise.pd: Likewise.
	* match-builtin.pd: Likewise.
	* match-constant-folding.pd: Likewise.
	* match-plusminus.pd: Likewise.
	* match-rotate.pd: Likewise.
	* match.pd: Likewise.
	* tree-ssa-forwprop.c: Likewise.
	* tree-ssa-sccvn.c: Likewise.

	* gimple-fold.c (fold_stmt): Add overload with valueize parameter.
	* gimple-fold.h (fold_stmt): Declare it.
	* tree-ssa-forwprop.c (pass_forwprop::execute): Use fold_stmt API.
	* tree-ssa-sccvn.c (try_to_simplify): Use
	gimple_fold_stmt_to_constant_1 API.

	* testsuite/gcc.dg/tree-ssa/match-1.c:
	s/match_and_simplified/simplified/g
	* testsuite/gcc.dg/tree-ssa/match-bitwise.c: Likewise
	* testsuite/gcc.dg/tree-ssa/match-plusminus.c: Likewise
	* testsuite/gcc.dg/tree-ssa/match-realimag.c: Likewise
	* testsuite/gcc.dg/tree-ssa/match-rotate.c: Likewise
	* testsuite/gcc.dg/tree-ssa/pr52631.c: Likewise


Index: gcc/doc/match-and-simplify.texi
===================================================================
--- gcc/doc/match-and-simplify.texi	(revision 213631)
+++ gcc/doc/match-and-simplify.texi	(working copy)
@@ -38,19 +38,19 @@ The main GIMPLE API entry to the express
 that of the GENERIC fold_@{unary,binary,ternary@} API:
 
 @deftypefn
-tree gimple_match_and_simplify (enum tree_code, tree, tree,
+tree gimple_simplify (enum tree_code, tree, tree,
                                 gimple_seq *, tree (*)(tree));
 @end deftypefn
 @deftypefn
-tree gimple_match_and_simplify (enum tree_code, tree, tree, tree,
+tree gimple_simplify (enum tree_code, tree, tree, tree,
                                 gimple_seq *, tree (*)(tree));
 @end deftypefn
 @deftypefn
-tree gimple_match_and_simplify (enum tree_code, tree, tree, tree, tree,
+tree gimple_simplify (enum tree_code, tree, tree, tree, tree,
                                 gimple_seq *, tree (*)(tree));
 @end deftypefn
 @deftypefn
-tree gimple_match_and_simplify (enum built_in_function, tree, tree,
+tree gimple_simplify (enum built_in_function, tree, tree,
                                 gimple_seq *, tree (*)(tree));
 @end deftypefn
 
@@ -63,7 +63,7 @@ tie simplifications to a SSA lattice.
 In addition to those APIs a fold_stmt-like interface is provided with
 
 @deftypefn
-bool gimple_match_and_simplify (gimple_stmt_iterator *, tree (*)(tree));
+bool gimple_simplify (gimple_stmt_iterator *, tree (*)(tree));
 @end deftypefn
 
 which also has the additional valueization hook.
@@ -103,13 +103,13 @@ domain-specific languages GCC uses.  Thu
 with an example from the match.pd file on the branch:
 
 @smallexample
-(match_and_simplify
+(simplify
   (bit_and @@0 integer_all_onesp)
   @@0)
 @end smallexample
 
 This example contains all required parts of an expression simplification.
-A simplification is wrapped inside a @code{(match_and_simplify ...)} expression.
+A simplification is wrapped inside a @code{(simplify ...)} expression.
 That contains at least two operands - an expression that is matched
 with the GIMPLE or GENERIC IL and a replacement expression that is
 returned if the match was successful.
@@ -123,7 +123,7 @@ you refer to it in other places of the m
 above example it is refered to in the replacement expression.
 
 @smallexample
-(match_and_simplify
+(simplify
   (bit_xor @@0 @@0)
   @{ build_zero_cst (type); @})
 @end smallexample
@@ -134,7 +134,7 @@ operands written in C code.  These can b
 replacements and are supposed to evaluate to a tree node.
 
 @smallexample
-(match_and_simplify
+(simplify
   (trunc_mod integer_zerop@@0 @@1)
   (if (!integer_zerop (@@1)))
   @@0)
@@ -145,7 +145,7 @@ which is also predicated with @code{inte
 may be either expressions, predicates or captures.  Captures
 can be unconstrained or capture expresions or predicates.
 
-This example introduces an optional operand of match_and_simplify,
+This example introduces an optional operand of simplify,
 the if-expression.  This condition is evaluated after the
 expression matched in the IL and is required to evaluate to true
 to enable the replacement expression.  The expression operand
@@ -153,7 +153,7 @@ of the @code{if} is a standard C express
 to captures.
 
 @smallexample
-(match_and_simplify
+(simplify
   (bit_and:c integral_op_p@@0 (bit_ior:c (bit_not @@0) @@1))
   (bit_and @@1 @@0))
 @end smallexample
@@ -176,7 +176,7 @@ Two more features exist to avoid too muc
 
 @smallexample
 (for op in plus pointer_plus minus bit_ior bit_xor
-  (match_and_simplify
+  (simplify
     (op @@0 integer_zerop)
     @@0))
 @end smallexample
@@ -187,10 +187,10 @@ operator specified, substituting @code{o
 @smallexample
 (if (!TYPE_SATURATING (type)
      && !FLOAT_TYPE_P (type) && !FIXED_POINT_TYPE_P (type))
-  (match_and_simplify
+  (simplify
     (minus (plus @@0 @@1) @@0)
     @@1)
-  (match_and_simplify
+  (simplify
     (minus (minus @@0 @@1) @@0)
     (negate @@1)))
 @end smallexample
Index: gcc/fold-const.c
===================================================================
--- gcc/fold-const.c	(revision 213574)
+++ gcc/fold-const.c	(working copy)
@@ -7793,8 +7793,8 @@ fold_unary_loc (location_t loc, enum tre
   gcc_assert (IS_EXPR_CODE_CLASS (kind)
 	      && TREE_CODE_LENGTH (code) == 1);
 
-  extern tree generic_match_and_simplify (enum tree_code, tree, tree);
-  tem = generic_match_and_simplify (code, type, op0);
+  extern tree generic_simplify (enum tree_code, tree, tree);
+  tem = generic_simplify (code, type, op0);
   if (tem)
     return tem;
 
@@ -10086,8 +10086,8 @@ fold_binary_loc (location_t loc,
 	      && op0 != NULL_TREE
 	      && op1 != NULL_TREE);
 
-  extern tree generic_match_and_simplify (enum tree_code, tree, tree, tree);
-  tem = generic_match_and_simplify (code, type, op0, op1);
+  extern tree generic_simplify (enum tree_code, tree, tree, tree);
+  tem = generic_simplify (code, type, op0, op1);
   if (tem)
     return tem;
 
@@ -14035,8 +14035,8 @@ fold_ternary_loc (location_t loc, enum t
   gcc_assert (IS_EXPR_CODE_CLASS (kind)
 	      && TREE_CODE_LENGTH (code) == 3);
 
-  extern tree generic_match_and_simplify (enum tree_code, tree, tree, tree, tree);
-  tem = generic_match_and_simplify (code, type, op0, op1, op2);
+  extern tree generic_simplify (enum tree_code, tree, tree, tree, tree);
+  tem = generic_simplify (code, type, op0, op1, op2);
   if (tem)
     return tem;
 
Index: gcc/genmatch.c
===================================================================
--- gcc/genmatch.c	(revision 213626)
+++ gcc/genmatch.c	(working copy)
@@ -87,12 +87,12 @@ output_line_directive (FILE *f, source_l
      transform = 'match_and_transform' name expr genop
 
      Match and simplify (A + B) - B -> A
-     (define_match_and_simplify foo
+     (simplify foo
        (PLUS_EXPR (MINUS_EXPR integral_op_p@0 @1) @1)
        @0)
 
      Match and simplify (CST + A) + CST to CST' + A
-     (define_match_and_simplify bar
+     (simplify bar
        (PLUS_EXPR INTEGER_CST_P@0 (PLUS_EXPR @1 INTEGER_CST_P@2))
        (PLUS_EXPR { int_const_binop (PLUS_EXPR, captures[0], captures[2]); } @1))
 */
@@ -694,7 +694,7 @@ expr::gen_transform (FILE *f, const char
 	 fail if seq == NULL.  */
       fprintf (f, "  if (!seq)\n"
 	       "    {\n"
-	       "      res = gimple_match_and_simplify (%s, TREE_TYPE (ops[0])",
+	       "      res = gimple_simplify (%s, TREE_TYPE (ops[0])",
 	       operation->op->id);
       for (unsigned i = 0; i < ops.length (); ++i)
 	fprintf (f, ", ops[%u]", i);
@@ -1610,9 +1610,9 @@ decision_tree::gen_gimple (FILE *f)
   for (unsigned n = 1; n <= 3; ++n)
     {
       fprintf (f, "\nstatic bool\n"
-	       "gimple_match_and_simplify (code_helper *res_code, tree *res_ops,\n"
-	       "                           gimple_seq *seq, tree (*valueize)(tree),\n"
-	       "                           code_helper code, tree type");
+	       "gimple_simplify (code_helper *res_code, tree *res_ops,\n"
+	       "                 gimple_seq *seq, tree (*valueize)(tree),\n"
+	       "                 code_helper code, tree type");
       for (unsigned i = 0; i < n; ++i)
 	fprintf (f, ", tree op%d", i);
       fprintf (f, ")\n");
@@ -1648,7 +1648,7 @@ decision_tree::gen_generic (FILE *f)
   for (unsigned n = 1; n <= 3; ++n)
     {
       fprintf (f, "\ntree\n"
-	       "generic_match_and_simplify (enum tree_code code, tree type ATTRIBUTE_UNUSED");
+	       "generic_simplify (enum tree_code code, tree type ATTRIBUTE_UNUSED");
       for (unsigned i = 0; i < n; ++i)
 	fprintf (f, ", tree op%d", i);
       fprintf (f, ")\n");
@@ -2045,11 +2045,11 @@ parse_op (cpp_reader *r)
 }
 
 /* Parse
-     (define_match_and_simplify "<ident>"
+     (simplify "<ident>"
         <op> <op>)  */
 
 static simplify *
-parse_match_and_simplify (cpp_reader *r, source_location match_location)
+parse_simplify (cpp_reader *r, source_location match_location)
 {
   const cpp_token *token = peek (r);
   const char *id;
@@ -2182,14 +2182,14 @@ parse_pattern (cpp_reader *r, vec<simpli
   eat_token (r, CPP_OPEN_PAREN);
   const cpp_token *token = peek (r);
   const char *id = get_ident (r);
-  if (strcmp (id, "match_and_simplify") == 0)
-    simplifiers.safe_push (parse_match_and_simplify (r, token->src_loc));
+  if (strcmp (id, "simplify") == 0)
+    simplifiers.safe_push (parse_simplify (r, token->src_loc));
   else if (strcmp (id, "for") == 0)
     parse_for (r, token->src_loc, simplifiers); 
   else if (strcmp (id, "if") == 0)
     parse_if (r, simplifiers);
   else
-    fatal_at (token, "expected 'match_and_simplify' or 'for'");
+    fatal_at (token, "expected 'simplify' or 'for' or 'if'");
 
   eat_token (r, CPP_CLOSE_PAREN);
 }
Index: gcc/gimple-fold.c
===================================================================
--- gcc/gimple-fold.c	(revision 213574)
+++ gcc/gimple-fold.c	(working copy)
@@ -1263,7 +1263,7 @@ gimple_fold_call (gimple_stmt_iterator *
    distinguishes both cases.  */
 
 static bool
-fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace)
+fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace, tree (*valueize) (tree))
 {
   bool changed = false;
   gimple stmt = gsi_stmt (*gsi);
@@ -1407,9 +1407,12 @@ fold_stmt_1 (gimple_stmt_iterator *gsi,
 
   /* Dispatch to pattern-based folding.
      ???  Do this after the previous stuff as fold_stmt is used to make
-     stmts valid gimple again via maybe_fold_reference of ops.  */
+     stmts valid gimple again via maybe_fold_reference of ops.
+     ???  Use a lower-level API using a NULL sequence for inplace
+     operation, basically inline gimple_simplify (gsi)
+     as we are the only caller.  */
   if (!inplace
-      && gimple_match_and_simplify (gsi, NULL))
+      && gimple_simplify (gsi, valueize))
     changed = true;
 
   return changed;
@@ -1425,7 +1428,13 @@ fold_stmt_1 (gimple_stmt_iterator *gsi,
 bool
 fold_stmt (gimple_stmt_iterator *gsi)
 {
-  return fold_stmt_1 (gsi, false);
+  return fold_stmt_1 (gsi, false, NULL);
+}
+
+bool
+fold_stmt (gimple_stmt_iterator *gsi, tree (*valueize) (tree))
+{
+  return fold_stmt_1 (gsi, false, valueize);
 }
 
 /* Perform the minimal folding on statement *GSI.  Only operations like
@@ -1440,7 +1449,7 @@ bool
 fold_stmt_inplace (gimple_stmt_iterator *gsi)
 {
   gimple stmt = gsi_stmt (*gsi);
-  bool changed = fold_stmt_1 (gsi, true);
+  bool changed = fold_stmt_1 (gsi, true, NULL);
   gcc_assert (gsi_stmt (*gsi) == stmt);
   return changed;
 }
@@ -2806,7 +2815,7 @@ gimple_fold_stmt_to_constant_1 (gimple s
   tree lhs = gimple_get_lhs (stmt);
   if (lhs)
     {
-      tree res = gimple_match_and_simplify (lhs, NULL, valueize);
+      tree res = gimple_simplify (lhs, NULL, valueize);
       if (res)
 	{
 	  if (dump_file && dump_flags & TDF_DETAILS)
@@ -3721,7 +3730,7 @@ gimple_build (gimple_seq *seq, location_
 	      enum tree_code code, tree type, tree op0,
 	      tree (*valueize)(tree))
 {
-  tree res = gimple_match_and_simplify (code, type, op0, seq, valueize);
+  tree res = gimple_simplify (code, type, op0, seq, valueize);
   if (!res)
     {
       res = make_ssa_name (type, NULL);
@@ -3751,7 +3760,7 @@ gimple_build (gimple_seq *seq, location_
 	      enum tree_code code, tree type, tree op0, tree op1,
 	      tree (*valueize)(tree))
 {
-  tree res = gimple_match_and_simplify (code, type, op0, op1, seq, valueize);
+  tree res = gimple_simplify (code, type, op0, op1, seq, valueize);
   if (!res)
     {
       res = make_ssa_name (type, NULL);
@@ -3774,8 +3783,8 @@ gimple_build (gimple_seq *seq, location_
 	      enum tree_code code, tree type, tree op0, tree op1, tree op2,
 	      tree (*valueize)(tree))
 {
-  tree res = gimple_match_and_simplify (code, type, op0, op1, op2,
-					seq, valueize);
+  tree res = gimple_simplify (code, type, op0, op1, op2,
+			      seq, valueize);
   if (!res)
     {
       res = make_ssa_name (type, NULL);
@@ -3804,7 +3813,7 @@ gimple_build (gimple_seq *seq, location_
 	      enum built_in_function fn, tree type, tree arg0,
 	      tree (*valueize)(tree))
 {
-  tree res = gimple_match_and_simplify (fn, type, arg0, seq, valueize);
+  tree res = gimple_simplify (fn, type, arg0, seq, valueize);
   if (!res)
     {
       res = make_ssa_name (type, NULL);
Index: gcc/gimple-fold.h
===================================================================
--- gcc/gimple-fold.h	(revision 213544)
+++ gcc/gimple-fold.h	(working copy)
@@ -27,6 +27,7 @@ extern tree get_symbol_constant_value (t
 extern void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
 extern tree gimple_fold_builtin (gimple);
 extern bool fold_stmt (gimple_stmt_iterator *);
+extern bool fold_stmt (gimple_stmt_iterator *, tree (*) (tree));
 extern bool fold_stmt_inplace (gimple_stmt_iterator *);
 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree, 
 					enum tree_code, tree, tree);
@@ -108,17 +109,17 @@ gimple_convert (gimple_seq *seq, tree ty
    in the sequence.  */
 
 /* In gimple-match.c.  */
-tree gimple_match_and_simplify (enum tree_code, tree, tree,
-				gimple_seq *, tree (*)(tree));
-tree gimple_match_and_simplify (enum tree_code, tree, tree, tree,
-				gimple_seq *, tree (*)(tree));
-tree gimple_match_and_simplify (enum tree_code, tree, tree, tree, tree,
-				gimple_seq *, tree (*)(tree));
-tree gimple_match_and_simplify (enum built_in_function, tree, tree,
-				gimple_seq *, tree (*)(tree));
+tree gimple_simplify (enum tree_code, tree, tree,
+		      gimple_seq *, tree (*)(tree));
+tree gimple_simplify (enum tree_code, tree, tree, tree,
+		      gimple_seq *, tree (*)(tree));
+tree gimple_simplify (enum tree_code, tree, tree, tree, tree,
+		      gimple_seq *, tree (*)(tree));
+tree gimple_simplify (enum built_in_function, tree, tree,
+		      gimple_seq *, tree (*)(tree));
 /* The following two APIs are an artifact and should vanish in favor
    of the existing gimple_fold_stmt_to_constant and fold_stmt APIs.  */
-tree gimple_match_and_simplify (tree, gimple_seq *, tree (*)(tree));
-bool gimple_match_and_simplify (gimple_stmt_iterator *, tree (*)(tree));
+tree gimple_simplify (tree, gimple_seq *, tree (*)(tree));
+bool gimple_simplify (gimple_stmt_iterator *, tree (*)(tree));
 
 #endif  /* GCC_GIMPLE_FOLD_H */
Index: gcc/gimple-match-head.c
===================================================================
--- gcc/gimple-match-head.c	(revision 213544)
+++ gcc/gimple-match-head.c	(working copy)
@@ -63,15 +63,15 @@ private:
 /* Forward declarations of the private auto-generated matchers.
    They expect valueized operands in canonical order and do not
    perform simplification of all-constant operands.  */
-static bool gimple_match_and_simplify (code_helper *, tree *,
-				       gimple_seq *, tree (*)(tree),
-				       code_helper, tree, tree);
-static bool gimple_match_and_simplify (code_helper *, tree *,
-				       gimple_seq *, tree (*)(tree),
-				       code_helper, tree, tree, tree);
-static bool gimple_match_and_simplify (code_helper *, tree *,
-				       gimple_seq *, tree (*)(tree),
-				       code_helper, tree, tree, tree, tree);
+static bool gimple_simplify (code_helper *, tree *,
+			     gimple_seq *, tree (*)(tree),
+			     code_helper, tree, tree);
+static bool gimple_simplify (code_helper *, tree *,
+			     gimple_seq *, tree (*)(tree),
+			     code_helper, tree, tree, tree);
+static bool gimple_simplify (code_helper *, tree *,
+			     gimple_seq *, tree (*)(tree),
+			     code_helper, tree, tree, tree, tree);
 
 
 /* Return whether T is a constant that we'll dispatch to fold to
@@ -88,7 +88,7 @@ constant_for_folding (tree t)
 
 
 /* Helper that matches and simplifies the toplevel result from
-   a gimple_match_and_simplify run (where we don't want to build
+   a gimple_simplify run (where we don't want to build
    a stmt in case it's used in in-place folding).  Replaces
    *RES_CODE and *RES_OPS with a simplified and/or canonicalized
    result and returns whether any change was made.  */
@@ -130,8 +130,8 @@ gimple_resimplify1 (gimple_seq *seq,
 
   code_helper res_code2;
   tree res_ops2[3] = {};
-  if (gimple_match_and_simplify (&res_code2, res_ops2, seq, valueize,
-				 *res_code, type, res_ops[0]))
+  if (gimple_simplify (&res_code2, res_ops2, seq, valueize,
+		       *res_code, type, res_ops[0]))
     {
       *res_code = res_code2;
       res_ops[0] = res_ops2[0];
@@ -144,7 +144,7 @@ gimple_resimplify1 (gimple_seq *seq,
 }
 
 /* Helper that matches and simplifies the toplevel result from
-   a gimple_match_and_simplify run (where we don't want to build
+   a gimple_simplify run (where we don't want to build
    a stmt in case it's used in in-place folding).  Replaces
    *RES_CODE and *RES_OPS with a simplified and/or canonicalized
    result and returns whether any change was made.  */
@@ -199,8 +199,8 @@ gimple_resimplify2 (gimple_seq *seq,
 
   code_helper res_code2;
   tree res_ops2[3] = {};
-  if (gimple_match_and_simplify (&res_code2, res_ops2, seq, valueize,
-				 *res_code, type, res_ops[0], res_ops[1]))
+  if (gimple_simplify (&res_code2, res_ops2, seq, valueize,
+		       *res_code, type, res_ops[0], res_ops[1]))
     {
       *res_code = res_code2;
       res_ops[0] = res_ops2[0];
@@ -213,7 +213,7 @@ gimple_resimplify2 (gimple_seq *seq,
 }
 
 /* Helper that matches and simplifies the toplevel result from
-   a gimple_match_and_simplify run (where we don't want to build
+   a gimple_simplify run (where we don't want to build
    a stmt in case it's used in in-place folding).  Replaces
    *RES_CODE and *RES_OPS with a simplified and/or canonicalized
    result and returns whether any change was made.  */
@@ -269,9 +269,9 @@ gimple_resimplify3 (gimple_seq *seq,
 
   code_helper res_code2;
   tree res_ops2[3] = {};
-  if (gimple_match_and_simplify (&res_code2, res_ops2, seq, valueize,
-				 *res_code, type,
-				 res_ops[0], res_ops[1], res_ops[2]))
+  if (gimple_simplify (&res_code2, res_ops2, seq, valueize,
+		       *res_code, type,
+		       res_ops[0], res_ops[1], res_ops[2]))
     {
       *res_code = res_code2;
       res_ops[0] = res_ops2[0];
@@ -329,9 +329,9 @@ maybe_push_res_to_seq (code_helper rcode
 }
 
 tree
-gimple_match_and_simplify (enum tree_code code, tree type,
-			   tree op0,
-			   gimple_seq *seq, tree (*valueize)(tree))
+gimple_simplify (enum tree_code code, tree type,
+		 tree op0,
+		 gimple_seq *seq, tree (*valueize)(tree))
 {
   if (constant_for_folding (op0))
     {
@@ -343,14 +343,14 @@ gimple_match_and_simplify (enum tree_cod
 
   code_helper rcode;
   tree ops[3] = {};
-  if (!gimple_match_and_simplify (&rcode, ops, seq, valueize,
-				  code, type, op0))
+  if (!gimple_simplify (&rcode, ops, seq, valueize,
+			code, type, op0))
     return NULL_TREE;
   return maybe_push_res_to_seq (rcode, type, ops, seq);
 }
 
 tree
-gimple_match_and_simplify (enum tree_code code, tree type,
+gimple_simplify (enum tree_code code, tree type,
 			   tree op0, tree op1,
 			   gimple_seq *seq, tree (*valueize)(tree))
 {
@@ -374,16 +374,16 @@ gimple_match_and_simplify (enum tree_cod
 
   code_helper rcode;
   tree ops[3] = {};
-  if (!gimple_match_and_simplify (&rcode, ops, seq, valueize,
-				  code, type, op0, op1))
+  if (!gimple_simplify (&rcode, ops, seq, valueize,
+			code, type, op0, op1))
     return NULL_TREE;
   return maybe_push_res_to_seq (rcode, type, ops, seq);
 }
 
 tree
-gimple_match_and_simplify (enum tree_code code, tree type,
-			   tree op0, tree op1, tree op2,
-			   gimple_seq *seq, tree (*valueize)(tree))
+gimple_simplify (enum tree_code code, tree type,
+		 tree op0, tree op1, tree op2,
+		 gimple_seq *seq, tree (*valueize)(tree))
 {
   if (constant_for_folding (op0) && constant_for_folding (op1)
       && constant_for_folding (op2))
@@ -406,14 +406,14 @@ gimple_match_and_simplify (enum tree_cod
 
   code_helper rcode;
   tree ops[3] = {};
-  if (!gimple_match_and_simplify (&rcode, ops, seq, valueize,
-				  code, type, op0, op1, op2))
+  if (!gimple_simplify (&rcode, ops, seq, valueize,
+			code, type, op0, op1, op2))
     return NULL_TREE;
   return maybe_push_res_to_seq (rcode, type, ops, seq);
 }
 
 tree
-gimple_match_and_simplify (enum built_in_function fn, tree type,
+gimple_simplify (enum built_in_function fn, tree type,
 			   tree arg0,
 			   gimple_seq *seq, tree (*valueize)(tree))
 {
@@ -436,16 +436,16 @@ gimple_match_and_simplify (enum built_in
 
   code_helper rcode;
   tree ops[3] = {};
-  if (!gimple_match_and_simplify (&rcode, ops, seq, valueize,
-				  fn, type, arg0))
+  if (!gimple_simplify (&rcode, ops, seq, valueize,
+			fn, type, arg0))
     return NULL_TREE;
   return maybe_push_res_to_seq (rcode, type, ops, seq);
 }
 
 static bool
-gimple_match_and_simplify (gimple stmt,
-			   code_helper *rcode, tree *ops,
-			   gimple_seq *seq, tree (*valueize)(tree))
+gimple_simplify (gimple stmt,
+		 code_helper *rcode, tree *ops,
+		 gimple_seq *seq, tree (*valueize)(tree))
 {
   if (is_gimple_assign (stmt))
     {
@@ -638,7 +638,7 @@ gimple_match_and_simplify (gimple stmt,
    SEQ) or NULL_TREE if no simplification was possible.  */
 
 tree
-gimple_match_and_simplify (tree name, gimple_seq *seq, tree (*valueize)(tree))
+gimple_simplify (tree name, gimple_seq *seq, tree (*valueize)(tree))
 {
   if (TREE_CODE (name) != SSA_NAME)
     return NULL_TREE;
@@ -662,7 +662,7 @@ gimple_match_and_simplify (tree name, gi
 
   code_helper rcode;
   tree ops[3] = {};
-  if (!gimple_match_and_simplify (stmt, &rcode, ops, seq, valueize))
+  if (!gimple_simplify (stmt, &rcode, ops, seq, valueize))
     return NULL_TREE;
   return maybe_push_res_to_seq (rcode, TREE_TYPE (name), ops, seq);
 }
@@ -671,13 +671,13 @@ gimple_match_and_simplify (tree name, gi
    sequence.  */
 
 bool
-gimple_match_and_simplify (gimple_stmt_iterator *gsi, tree (*valueize)(tree))
+gimple_simplify (gimple_stmt_iterator *gsi, tree (*valueize)(tree))
 {
   gimple stmt = gsi_stmt (*gsi);
   gimple_seq seq = NULL;
   code_helper rcode;
   tree ops[3] = {};
-  if (!gimple_match_and_simplify (stmt, &rcode, ops, &seq, valueize))
+  if (!gimple_simplify (stmt, &rcode, ops, &seq, valueize))
     return false;
 
   if (is_gimple_assign (stmt)
Index: gcc/match-bitwise.pd
===================================================================
--- gcc/match-bitwise.pd	(revision 213544)
+++ gcc/match-bitwise.pd	(working copy)
@@ -37,66 +37,66 @@ along with GCC; see the file COPYING3.
 */
 
 /* x & x -> x */
-(match_and_simplify
+(simplify
   (bit_and integral_op_p@0 @0)
   @0)
 
 /* x & ~x -> 0 */
-(match_and_simplify
+(simplify
   (bit_and:c integral_op_p@0 (bit_not @0))
   { build_int_cst (type, 0); })
 
 /* ~x & ~y -> ~(x | y) */
-(match_and_simplify
+(simplify
   (bit_and (bit_not integral_op_p@0) (bit_not @1))
   (bit_not (bit_ior @0 @1)))
 
 /* ~x | ~y -> ~(x & y) */
-(match_and_simplify
+(simplify
   (bit_ior (bit_not integral_op_p@0) (bit_not @1))
   (bit_not (bit_and @0 @1)))
 
 /* x & (~x | y) -> y & x */
-(match_and_simplify
+(simplify
   (bit_and:c integral_op_p@0 (bit_ior:c (bit_not @0) @1))
   (bit_and @1 @0))
 
 /* (x | CST1) & CST2 -> (x & CST2) | (CST1 & CST2) */
-(match_and_simplify
+(simplify
   (bit_and (bit_ior integral_op_p@0 INTEGER_CST_P@1) INTEGER_CST_P@2)
   (bit_ior (bit_and @0 @2) (bit_and @1 @2)))
 
 /* x ^ ~0 -> ~x */
-(match_and_simplify
+(simplify
   (bit_xor @0 integer_all_onesp@1)
   (bit_not @0))
 
 /* (x | y) & x -> x */
-(match_and_simplify
+(simplify
   (bit_and:c (bit_ior integral_op_p@0 @1) @0)
   @0)
 
 /* (x & y) | x -> x */
-(match_and_simplify
+(simplify
   (bit_ior:c (bit_and integral_op_p@0 @1) @0)
   @0)
 
 /* (~x | y) & x -> x & y */
-(match_and_simplify
+(simplify
   (bit_and:c (bit_ior:c (bit_not integral_op_p@0) @1) @0)
   (bit_and @0 @1))
 
 /* (~x & y) | x -> x | y */
-(match_and_simplify
+(simplify
   (bit_ior:c (bit_and:c (bit_not integral_op_p@0) @1) @0)
   (bit_ior @0 @1))
 
 /* ~~x -> x */
-(match_and_simplify
+(simplify
   (bit_not (bit_not integral_op_p@0))
   @0)
 
 /* ((a & b) & ~a) -> 0 */
-(match_and_simplify
+(simplify
   (bit_and:c (bit_and integral_op_p@0 @1) (bit_not @0))
   { build_int_cst (type, 0); })
Index: gcc/match-builtin.pd
===================================================================
--- gcc/match-builtin.pd	(revision 213544)
+++ gcc/match-builtin.pd	(working copy)
@@ -19,22 +19,22 @@ along with GCC; see the file COPYING3.
 
 
 /* One builtin function to atom.  */
-(match_and_simplify
+(simplify
   (BUILT_IN_SQRT (mult @0 @0))
   @0)
 /* One builtin function to builtin function.  */
-(match_and_simplify
+(simplify
   (BUILT_IN_CABS (complex:c @0 real_zerop))
   (BUILT_IN_FABS @0))
 /* One builtin function to expr.  */
-(match_and_simplify
+(simplify
   (BUILT_IN_CABS (complex @0 @0))
   (mult (BUILT_IN_FABS @0) { build_real (TREE_TYPE (@0), real_value_truncate (TYPE_MODE (TREE_TYPE (@0)), dconst_sqrt2 ())); }))
 /* One nested fn.  */
-(match_and_simplify
+(simplify
   (mult:c (BUILT_IN_POW @0 @1) @0)
   (BUILT_IN_POW @0 (PLUS_EXPR @1 { build_one_cst (TREE_TYPE (@1)); })))
-(match_and_simplify
+(simplify
   (BUILT_IN_POW @0 REAL_CST_P@1)
   /* This needs to be conditionalized on flag_unsafe_math_optimizations,
      but we keep it for now to exercise function re-optimization.
Index: gcc/match-constant-folding.pd
===================================================================
--- gcc/match-constant-folding.pd	(revision 213544)
+++ gcc/match-constant-folding.pd	(working copy)
@@ -18,48 +18,48 @@ along with GCC; see the file COPYING3.
 <http://www.gnu.org/licenses/>.  */
 
 (for op in plus pointer_plus minus bit_ior bit_xor
-  (match_and_simplify
+  (simplify
     (op @0 integer_zerop)
     @0))
 
-(match_and_simplify
+(simplify
   (minus @0 @0)
   { build_zero_cst (type); })
 
-(match_and_simplify
+(simplify
   (mult @0 integer_zerop@1)
   @1)
 
 /* Make sure to preserve divisions by zero.  This is the reason why
    we don't simplify x / x to 1 or 0 / x to 0.  */
 (for op in mult trunc_div ceil_div floor_div round_div
-  (match_and_simplify
+  (simplify
     (op @0 integer_onep)
     @0))
 
-(match_and_simplify
+(simplify
   (trunc_mod @0 integer_onep)
   { build_zero_cst (type); })
 /* Same applies to modulo operations, but fold is inconsistent here
    and simplifies 0 % x to 0.  */
-(match_and_simplify
+(simplify
   (trunc_mod integer_zerop@0 @1)
   (if (!integer_zerop (@1)))
   @0)
 
-(match_and_simplify
+(simplify
   (bit_ior @0 integer_all_onesp@1)
   @1)
 
-(match_and_simplify
+(simplify
   (bit_and @0 integer_all_onesp)
   @0)
 
-(match_and_simplify
+(simplify
   (bit_and @0 integer_zerop@1)
   @1)
 
-(match_and_simplify
+(simplify
   (bit_xor @0 @0)
   { build_zero_cst (type); })
 
Index: gcc/match-plusminus.pd
===================================================================
--- gcc/match-plusminus.pd	(revision 213626)
+++ gcc/match-plusminus.pd	(working copy)
@@ -17,15 +17,15 @@ You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-/* ???  Have match_and_simplify groups guarded with common
+/* ???  Have simplify groups guarded with common
    predicates on the outermost type?  */
 
 /* Contract negates.  */
-(match_and_simplify
+(simplify
   (plus:c @0 (negate @1))
   (if (!TYPE_SATURATING (type)))
   (minus @0 @1))
-(match_and_simplify
+(simplify
   (minus @0 (negate @1))
   (if (!TYPE_SATURATING (type)))
   (plus @0 @1))
@@ -39,35 +39,35 @@ along with GCC; see the file COPYING3.
 
 (if (!TYPE_SATURATING (type)
     && !FLOAT_TYPE_P (type) && !FIXED_POINT_TYPE_P (type))
-  (match_and_simplify
+  (simplify
     (minus (plus @0 @1) @0)
     @1)
 
-  (match_and_simplify
+  (simplify
     (minus (minus @0 @1) @0)
     (negate @1))
 
-  (match_and_simplify
+  (simplify
     (minus (plus @0 @1) @1)
     @0)
 
-  (match_and_simplify
+  (simplify
     (plus:c (minus @0 @1) @1)
     @0))
 
 /* (CST +- A) +- CST -> CST' +- A.  */
-/* match_and_simplify handles constant folding for us so we can
+/* simplify handles constant folding for us so we can
    implement these as re-association patterns.
    Watch out for operand order and constant canonicalization
    we do!  A - CST -> A + -CST, CST + A -> A + CST.  */
-(match_and_simplify
+(simplify
   (plus (plus @0 INTEGER_CST_P@1) INTEGER_CST_P@2)
   /* If the constant operation overflows we cannot do the transform
      as we would introduce undefined overflow, for example
      with (a - 1) + INT_MIN.  */
   (if (!TREE_OVERFLOW (@1 = int_const_binop (PLUS_EXPR, @1, @2))))
   (plus @0 @1))
-(match_and_simplify
+(simplify
   (plus (minus INTEGER_CST_P@0 @1) INTEGER_CST_P@2)
   (minus (plus @0 @2) @1))
 /* TODO:
@@ -83,35 +83,35 @@ along with GCC; see the file COPYING3.
  */
 
 /* ~A + A -> -1 */
-(match_and_simplify
+(simplify
   (plus:c (bit_not @0) @0)
   { build_all_ones_cst (type); })
 
 /* ~A + 1 -> -A */
-(match_and_simplify
+(simplify
   (plus (bit_not integral_op_p@0) integer_onep)
   (negate @0)) 
 
 /* A - (A +- B) -> -+ B */
-(match_and_simplify
+(simplify
   (minus @0 (plus:c @0 @1))
   (negate @1))
-(match_and_simplify
+(simplify
   (minus @0 (minus @0 @1))
   @1)
 
 /* (T)(P + A) - (T)P -> (T) A */
-(match_and_simplify
+(simplify
   (minus (convert (pointer_plus @0 @1))
 	 (convert @0))
   (convert @1)) 
 
 /* associate_pointerplus: (ptr p+ off1) p+ off2 -> ptr p+ (off1 + off2) */
-(match_and_simplify
+(simplify
   (pointer_plus (pointer_plus @0 @1) @3)
   (pointer_plus @0 (plus @1 @3)))
 
 /* associate_pointerplus_diff: ptr1 p+ (ptr2 - ptr1) -> ptr2 */
-(match_and_simplify
+(simplify
   (pointer_plus @0 (convert (minus (convert @1) (convert @0))))
   @1)
Index: gcc/match-rotate.pd
===================================================================
--- gcc/match-rotate.pd	(revision 213544)
+++ gcc/match-rotate.pd	(working copy)
@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3.
 
 /* (x << CNT1) OP (x >> CNT2) -> x r<< CNT1 OP being +, |, ^ */
 (for op in plus bit_ior bit_xor 
-(match_and_simplify
+(simplify
   (op:c (lshift @0 INTEGER_CST_P@1) (rshift @0 INTEGER_CST_P@2))
   (if (INTEGRAL_TYPE_P (type) && TYPE_UNSIGNED (type)
       && TYPE_PRECISION (type) == GET_MODE_PRECISION (TYPE_MODE (type))
Index: gcc/match.pd
===================================================================
--- gcc/match.pd	(revision 213544)
+++ gcc/match.pd	(working copy)
@@ -39,7 +39,7 @@ along with GCC; see the file COPYING3.
    expansion which folds a POINTER_PLUS_EXPR and doesn't expect
    an ADDR_EXPR in return.  */
 #if GIMPLE
-(match_and_simplify
+(simplify
   (pointer_plus (addr@2 @0) INTEGER_CST_P@1)
   (if (is_gimple_min_invariant (@2)))
   {
@@ -64,26 +64,26 @@ along with GCC; see the file COPYING3.
      Fold (X << C1) & C2 into (X << C1) & (C2 | ((1 << C1) - 1))
      (X >> C1) & C2 into (X >> C1) & (C2 | ~((type) -1 >> C1))
      if the new mask might be further optimized.  */
-(match_and_simplify
+(simplify
   (bit_and (rshift@0 @1 INTEGER_CST_P@2) integer_onep)
   (if (compare_tree_int (@2, TYPE_PRECISION (TREE_TYPE (@1)) - 1) == 0))
   @0)
 
 /* COMPLEX_EXPR and REALPART/IMAGPART_EXPR cancellations.  */
-(match_and_simplify
+(simplify
   (complex (realpart @0) (imagpart @0))
   @0)
-(match_and_simplify
+(simplify
   (realpart (complex @0 @1))
   @0)
-(match_and_simplify
+(simplify
   (imagpart (complex @0 @1))
   @1)
 
 /* One unary pattern.  */
 
 /* fold_negate_exprs convert - (~A) to A + 1.  */
-(match_and_simplify
+(simplify
   (negate (bit_not integral_op_p@0))
   (plus @0 { build_int_cst (TREE_TYPE (@0), 1); } ))
 
@@ -91,13 +91,13 @@ along with GCC; see the file COPYING3.
 
 /* Due to COND_EXPRs weirdness in GIMPLE the following won't work
    without some hacks in the code generator.  */
-(match_and_simplify
+(simplify
   (cond (bit_not @0) @1 @2)
   (cond @0 @2 @1))
 
 /* match-and-simplify handles constant folding so we
    can just do the decomposition here.  */
-(match_and_simplify
+(simplify
   (fma INTEGER_CST_P@0 INTEGER_CST_P@1 @3)
   (plus (mult @0 @1) @3))
 
Index: gcc/testsuite/gcc.dg/tree-ssa/match-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/match-1.c	(revision 213544)
+++ gcc/testsuite/gcc.dg/tree-ssa/match-1.c	(working copy)
@@ -7,7 +7,7 @@ double test1 (_Complex double z)
   return __builtin_cabs (z);
 }
 
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to \[^\n\r\]*fabs" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to \[^\n\r\]*fabs" "forwprop1" } } */
 
 double test2 (double x)
 {
@@ -16,7 +16,7 @@ double test2 (double x)
   return __builtin_cabs (z);
 }
 
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to \[^\n\r\]*= _\\d\+ \\* 1.41" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to \[^\n\r\]*= _\\d\+ \\* 1.41" "forwprop1" } } */
 
 double test3 (double x)
 {
@@ -24,7 +24,7 @@ double test3 (double x)
   return y * x;
 }
 
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to \[^\n\r\]*pow \\(x_\\d\+\\(D\\), 6" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to \[^\n\r\]*pow \\(x_\\d\+\\(D\\), 6" "forwprop1" } } */
 
 double test4 (double w)
 {
@@ -33,6 +33,6 @@ double test4 (double w)
   return y * x;
 }
 
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to \[^\n\r\]*= w_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to \[^\n\r\]*= w_\\d\+\\(D\\)" "forwprop1" } } */
 
 /* { dg-final { cleanup-tree-dump "forwprop1" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/match-bitwise.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/match-bitwise.c	(revision 213544)
+++ gcc/testsuite/gcc.dg/tree-ssa/match-bitwise.c	(working copy)
@@ -8,7 +8,7 @@ int bitwise_1(int x)
   int bitwise_1_val = t1 & x;
   return bitwise_1_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to bitwise_1_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to bitwise_1_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
 
 /* x & ~x -> 0 */
 int bitwise_2(int x)
@@ -17,7 +17,7 @@ int bitwise_2(int x)
   int bitwise_2_val = t1 & x;
   return bitwise_2_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to bitwise_2_val_\\d\+ = 0" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to bitwise_2_val_\\d\+ = 0" "forwprop1" } } */
 
 /* x ^ x -> 0 */
 int bitwise_3(int x)
@@ -26,7 +26,7 @@ int bitwise_3(int x)
   int bitwise_3_val = t1 ^ x;
   return bitwise_3_val; 
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to bitwise_3_val_\\d\+ = 0" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to bitwise_3_val_\\d\+ = 0" "forwprop1" } } */
 
 /* ~~x -> 0 */
 int bitwise_4(int x)
@@ -35,7 +35,7 @@ int bitwise_4(int x)
   int bitwise_4_val = ~t1;
   return bitwise_4_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to bitwise_4_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to bitwise_4_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
 
 /* (x | y) & x -> x */
 int bitwise_5(int x, int y)
@@ -44,7 +44,7 @@ int bitwise_5(int x, int y)
   int bitwise_5_val = t1 & x;
   return bitwise_5_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to bitwise_5_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to bitwise_5_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
 
 /* (x & y) | x -> x */
 int bitwise_6(int x, int y)
@@ -53,7 +53,7 @@ int bitwise_6(int x, int y)
   int bitwise_6_val = t1 | x;
   return bitwise_6_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to bitwise_6_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to bitwise_6_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
 
 /* (~x & y) | x -> x | y */
 int bitwise_7(int x, int y)
@@ -63,7 +63,7 @@ int bitwise_7(int x, int y)
   int bitwise_7_val = t2 | x;
   return bitwise_7_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to bitwise_7_val_\\d\+ = x_\\d\+\\(D\\) | y_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to bitwise_7_val_\\d\+ = x_\\d\+\\(D\\) | y_\\d\+\\(D\\)" "forwprop1" } } */
 
 /* (~x | y) & x -> x & y */
 int bitwise_8(int x, int y)
@@ -73,7 +73,7 @@ int bitwise_8(int x, int y)
   int bitwise_8_val = t2 & x;
   return bitwise_8_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to bitwise_8_val_\\d\+ = x_\\d\+\\(D\\) & y_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to bitwise_8_val_\\d\+ = x_\\d\+\\(D\\) & y_\\d\+\\(D\\)" "forwprop1" } } */
 
 /*  ((x & y) & ~x) & ~y -> 0 */
 int bitwise_9(int x, int y)
@@ -83,6 +83,6 @@ int bitwise_9(int x, int y)
   int bitwise_9_val = t1 & t2; 
   return bitwise_9_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to bitwise_9_val_\\d\+ = 0" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to bitwise_9_val_\\d\+ = 0" "forwprop1" } } */
 
 /* { dg-final { cleanup-tree-dump "forwprop2" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/match-plusminus.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/match-plusminus.c	(revision 213626)
+++ gcc/testsuite/gcc.dg/tree-ssa/match-plusminus.c	(working copy)
@@ -8,7 +8,7 @@ int plusminus_1(int x, int y)
   int plusminus_1_val = x + t1;
   return plusminus_1_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to plusminus_1_val_\\d\+ = x_\\d\+\\(D\\) - y_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to plusminus_1_val_\\d\+ = x_\\d\+\\(D\\) - y_\\d\+\\(D\\)" "forwprop1" } } */
 
 /* x - (-y) -> y + x */
 int plusminus_2(int x, int y)
@@ -17,7 +17,7 @@ int plusminus_2(int x, int y)
   int plusminus_2_val = x - t1;
   return plusminus_2_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to plusminus_2_val_\\d\+ = y_\\d\+\\(D\\) \\+ x_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to plusminus_2_val_\\d\+ = y_\\d\+\\(D\\) \\+ x_\\d\+\\(D\\)" "forwprop1" } } */
 
 /* (x + y) - x -> y */
 int plusminus_3(int x, int y)
@@ -26,7 +26,7 @@ int plusminus_3(int x, int y)
   int plusminus_3_val = t1 - x;
   return plusminus_3_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to plusminus_3_val_\\d\+ = y_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to plusminus_3_val_\\d\+ = y_\\d\+\\(D\\)" "forwprop1" } } */
 
 /* (x - y) - x -> -y */
 int plusminus_4(int x, int y)
@@ -35,7 +35,7 @@ int plusminus_4(int x, int y)
   int plusminus_4_val = t1 - x;
   return plusminus_4_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to plusminus_4_val_\\d\+ = -y_\\d\+\\(D\\)" "forwprop1" } } */ 
+/* { dg-final { scan-tree-dump "gimple_simplified to plusminus_4_val_\\d\+ = -y_\\d\+\\(D\\)" "forwprop1" } } */ 
 
 /* (x + y) - y -> x */
 int plusminus_5(int x, int y)
@@ -44,7 +44,7 @@ int plusminus_5(int x, int y)
   int plusminus_5_val = t1 - y;
   return plusminus_5_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to plusminus_5_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to plusminus_5_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
 
 /* (x - y) + y -> x */
 int plusminus_6(int x, int y)
@@ -53,7 +53,7 @@ int plusminus_6(int x, int y)
   int plusminus_6_val = t1 + y;
   return plusminus_6_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to plusminus_6_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to plusminus_6_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
 
 /* (x + cst1) + cst2 -> x + (cst1 + cst2) */
 int plusminus_7(int x)
@@ -62,7 +62,7 @@ int plusminus_7(int x)
   int plusminus_7_val = t1 + 4;
   return plusminus_7_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to plusminus_7_val_\\d\+ = x_\\d\+\\(D\\) \\+ 7" "forwprop1" } } */ 
+/* { dg-final { scan-tree-dump "gimple_simplified to plusminus_7_val_\\d\+ = x_\\d\+\\(D\\) \\+ 7" "forwprop1" } } */ 
 
 /* (cst1 - x) + cst2 -> (cst1 + cst2) - x */
 int plusminus_8(int x)
@@ -71,7 +71,7 @@ int plusminus_8(int x)
   int plusminus_8_val = t1 + 4;
   return plusminus_8_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to plusminus_8_val_\\d\+ = 7 - x_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to plusminus_8_val_\\d\+ = 7 - x_\\d\+\\(D\\)" "forwprop1" } } */
 
 /* ptr1 p+ (ptr2 - ptr1) -> ptr2 */
 unsigned char *
@@ -81,6 +81,6 @@ plusminus_9(unsigned char *ptr1, unsigne
   unsigned char *plusminus_9_val = ptr1 + t1;
   return plusminus_9_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to plusminus_9_val_\\d\+ = ptr2" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to plusminus_9_val_\\d\+ = ptr2" "forwprop1" } } */
 
 /* { dg-final { cleanup-tree-dump "forwprop2" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/match-realimag.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/match-realimag.c	(revision 213544)
+++ gcc/testsuite/gcc.dg/tree-ssa/match-realimag.c	(working copy)
@@ -8,6 +8,6 @@ double realimag_1(double x)
   double realimag_1_val = __real t1;
   return realimag_1_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to realimag_1_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to realimag_1_val_\\d\+ = x_\\d\+\\(D\\)" "forwprop1" } } */
 
 /* { dg-final { cleanup-tree-dump "forwprop2" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/match-rotate.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/match-rotate.c	(revision 213544)
+++ gcc/testsuite/gcc.dg/tree-ssa/match-rotate.c	(working copy)
@@ -9,7 +9,7 @@ rotate_1 (unsigned char x)
   unsigned char rotate_1_val = t1 + t2;
   return rotate_1_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to rotate_1_val_\\d\+ = x_\\d\+\\(D\\) r<< 5" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to rotate_1_val_\\d\+ = x_\\d\+\\(D\\) r<< 5" "forwprop1" } } */
 
 unsigned char
 rotate_2 (unsigned char x)
@@ -19,7 +19,7 @@ rotate_2 (unsigned char x)
   unsigned char rotate_2_val = t1 + t2;
   return rotate_2_val;
 }
-/* { dg-final { scan-tree-dump-not "gimple_match_and_simplified to rotate_2_val_\\d\+ = x_\\d\+\\(D\\) r<< 5" "forwprop1" } } */
+/* { dg-final { scan-tree-dump-not "gimple_simplified to rotate_2_val_\\d\+ = x_\\d\+\\(D\\) r<< 5" "forwprop1" } } */
 
 unsigned char
 rotate_3 (unsigned char x)
@@ -29,7 +29,7 @@ rotate_3 (unsigned char x)
   unsigned char rotate_3_val = t1 | t2;
   return rotate_3_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to rotate_3_val_\\d\+ = x_\\d\+\\(D\\) r<< 5" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to rotate_3_val_\\d\+ = x_\\d\+\\(D\\) r<< 5" "forwprop1" } } */
 
 unsigned char
 rotate_4 (unsigned char x)
@@ -39,6 +39,6 @@ rotate_4 (unsigned char x)
   unsigned char rotate_4_val = t1 ^ t2;
   return rotate_4_val;
 }
-/* { dg-final { scan-tree-dump "gimple_match_and_simplified to rotate_4_val_\\d\+ = x_\\d\+\\(D\\) r<< 5" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "gimple_simplified to rotate_4_val_\\d\+ = x_\\d\+\\(D\\) r<< 5" "forwprop1" } } */
 
 /* { dg-final { cleanup-tree-dump "forwprop1" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/pr52631.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/pr52631.c	(revision 213544)
+++ gcc/testsuite/gcc.dg/tree-ssa/pr52631.c	(working copy)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-fre1-details" } */
+/* { dg-options "-O2 -fno-tree-forwprop -fdump-tree-fre1-details" } */
 
 unsigned f(unsigned a)
 {
Index: gcc/tree-ssa-forwprop.c
===================================================================
--- gcc/tree-ssa-forwprop.c	(revision 213574)
+++ gcc/tree-ssa-forwprop.c	(working copy)
@@ -3592,7 +3592,7 @@ simplify_mult (gimple_stmt_iterator *gsi
 
 static vec<tree> lattice;
 
-/* Primitive "lattice" function for gimple_match_and_simplify to discard
+/* Primitive "lattice" function for gimple_simplify to discard
    matches on names whose definition contains abnormal SSA names.  */
 
 static tree
@@ -3664,15 +3664,16 @@ pass_forwprop::execute (function *fun)
 	{
 	  gimple stmt = gsi_stmt (gsi);
 
-	  if (gimple_match_and_simplify (&gsi, fwprop_ssa_val))
+	  if (fold_stmt (&gsi, fwprop_ssa_val))
 	    {
 	      stmt = gsi_stmt (gsi);
 	      if (maybe_clean_or_replace_eh_stmt (stmt, stmt)
 		  && gimple_purge_dead_eh_edges (bb))
 		cfg_changed = true;
+	      update_stmt (stmt);
 	      if (dump_file && (dump_flags & TDF_DETAILS))
 		{
-		  fprintf (dump_file, "gimple_match_and_simplified to ");
+		  fprintf (dump_file, "gimple_simplified to ");
 		  print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
 		}
 	    }
Index: gcc/tree-ssa-sccvn.c
===================================================================
--- gcc/tree-ssa-sccvn.c	(revision 213574)
+++ gcc/tree-ssa-sccvn.c	(working copy)
@@ -2866,8 +2866,8 @@ visit_reference_op_load (tree lhs, tree
 	 of VIEW_CONVERT_EXPR <TREE_TYPE (result)> (result).
 	 So first simplify and lookup this expression to see if it
 	 is already available.  */
-      tree val = gimple_match_and_simplify (VIEW_CONVERT_EXPR, TREE_TYPE (op),
-					    result, NULL, vn_valueize);
+      tree val = gimple_simplify (VIEW_CONVERT_EXPR, TREE_TYPE (op),
+				  result, NULL, vn_valueize);
       if (!val)
 	val = vn_nary_op_lookup_pieces (1, VIEW_CONVERT_EXPR,
 					TREE_TYPE (op), &result, NULL);
@@ -3084,6 +3084,7 @@ static tree
 try_to_simplify (gimple stmt)
 {
   enum tree_code code = gimple_assign_rhs_code (stmt);
+  tree tem;
 
   /* For stores we can end up simplifying a SSA_NAME rhs.  Just return
      in this case, there is no point in doing extra work.  */
@@ -3094,11 +3095,13 @@ try_to_simplify (gimple stmt)
      ???  Handle multiple stmts being generated by storing
      at most one in VN_INFO->expr?  But then we'd have to
      transparently support materializing temporary SSA names
-     created by gimple_match_and_simplify - or we never value-number
+     created by gimple_simplify - or we never value-number
      to them.  */
-  if (TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME)
-    return gimple_match_and_simplify (gimple_assign_lhs (stmt),
-				      NULL, vn_valueize);
+  tem = gimple_fold_stmt_to_constant_1 (stmt, vn_valueize);
+  if (tem
+      && (TREE_CODE (tem) == SSA_NAME
+	  || is_gimple_min_invariant (tem)))
+    return tem;
 
   return NULL_TREE;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]