OSDN Git Service

2010-11-16 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Nov 2010 12:57:34 +0000 (12:57 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Nov 2010 12:57:34 +0000 (12:57 +0000)
* tree-ssa-sccvn.c (visit_unary_op): Rename to ...
(visit_nary_op): ... this.
(visit_binary_op): Remove.
(visit_use): Adjust and handle GIMPLE_TERNARY_RHS.

* gcc.dg/tree-ssa/ssa-fre-30.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166795 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-30.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.c

index 7f68583..3329ae3 100644 (file)
@@ -1,5 +1,12 @@
 2010-11-16  Richard Guenther  <rguenther@suse.de>
 
+       * tree-ssa-sccvn.c (visit_unary_op): Rename to ...
+       (visit_nary_op): ... this.
+       (visit_binary_op): Remove.
+       (visit_use): Adjust and handle GIMPLE_TERNARY_RHS.
+
+2010-11-16  Richard Guenther  <rguenther@suse.de>
+
        PR middle-end/45172
        * tree-eh.c (cleanup_empty_eh_unsplit): Avoid creating duplicate
        edges.
index b2ee19c..3ef9ee0 100644 (file)
@@ -1,5 +1,9 @@
 2010-11-16  Richard Guenther  <rguenther@suse.de>
 
+       * gcc.dg/tree-ssa/ssa-fre-30.c: New testcase.
+
+2010-11-16  Richard Guenther  <rguenther@suse.de>
+
        PR middle-end/45172
        * gfortran.dg/gomp/pr45172.f90: New testcase.
 
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-30.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-30.c
new file mode 100644 (file)
index 0000000..bfbef80
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ffinite-math-only -fdump-tree-optimized" } */
+
+float foo(float x, float y, float z)
+{
+  float a = __builtin_fmaf (x, y, z);
+  float b = __builtin_fmaf (x, y, z);
+  return a - b;
+}
+
+/* { dg-final { scan-tree-dump "return 0" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
index 994e945..01b66ae 100644 (file)
@@ -2167,41 +2167,17 @@ visit_copy (tree lhs, tree rhs)
   return set_ssa_val_to (lhs, rhs);
 }
 
-/* Visit a unary operator RHS, value number it, and return true if the
+/* Visit a nary operator RHS, value number it, and return true if the
    value number of LHS has changed as a result.  */
 
 static bool
-visit_unary_op (tree lhs, gimple stmt)
+visit_nary_op (tree lhs, gimple stmt)
 {
   bool changed = false;
   tree result = vn_nary_op_lookup_stmt (stmt, NULL);
 
   if (result)
-    {
-      changed = set_ssa_val_to (lhs, result);
-    }
-  else
-    {
-      changed = set_ssa_val_to (lhs, lhs);
-      vn_nary_op_insert_stmt (stmt, lhs);
-    }
-
-  return changed;
-}
-
-/* Visit a binary operator RHS, value number it, and return true if the
-   value number of LHS has changed as a result.  */
-
-static bool
-visit_binary_op (tree lhs, gimple stmt)
-{
-  bool changed = false;
-  tree result = vn_nary_op_lookup_stmt (stmt, NULL);
-
-  if (result)
-    {
-      changed = set_ssa_val_to (lhs, result);
-    }
+    changed = set_ssa_val_to (lhs, result);
   else
     {
       changed = set_ssa_val_to (lhs, lhs);
@@ -2909,10 +2885,9 @@ visit_use (tree use)
                  switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt)))
                    {
                    case GIMPLE_UNARY_RHS:
-                     changed = visit_unary_op (lhs, stmt);
-                     break;
                    case GIMPLE_BINARY_RHS:
-                     changed = visit_binary_op (lhs, stmt);
+                   case GIMPLE_TERNARY_RHS:
+                     changed = visit_nary_op (lhs, stmt);
                      break;
                    case GIMPLE_SINGLE_RHS:
                      switch (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)))
@@ -2921,10 +2896,10 @@ visit_use (tree use)
                          /* VOP-less references can go through unary case.  */
                          if ((gimple_assign_rhs_code (stmt) == REALPART_EXPR
                               || gimple_assign_rhs_code (stmt) == IMAGPART_EXPR
-                              || gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR )
+                              || gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR)
                              && TREE_CODE (TREE_OPERAND (gimple_assign_rhs1 (stmt), 0)) == SSA_NAME)
                            {
-                             changed = visit_unary_op (lhs, stmt);
+                             changed = visit_nary_op (lhs, stmt);
                              break;
                            }
                          /* Fallthrough.  */
@@ -2935,7 +2910,7 @@ visit_use (tree use)
                        case tcc_expression:
                          if (gimple_assign_rhs_code (stmt) == ADDR_EXPR)
                            {
-                             changed = visit_unary_op (lhs, stmt);
+                             changed = visit_nary_op (lhs, stmt);
                              break;
                            }
                          /* Fallthrough.  */