tree.c (operand_equal_for_phi_arg_p): New.
authorKazu Hirata <kazu@cs.umass.edu>
Sat, 27 Nov 2004 17:26:17 +0000 (17:26 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Sat, 27 Nov 2004 17:26:17 +0000 (17:26 +0000)
* tree.c (operand_equal_for_phi_arg_p): New.
* tree.h: Add a prototype for operand_equal_for_phi_arg_p.
* tree-cfg.c, tree-ssa-dom.c, tree-ssa-phiopt.c, tree-ssa.c:
Replace operand_equal_p with operand_for_phi_arg_p
appropriately.

From-SVN: r91385

gcc/ChangeLog
gcc/tree-cfg.c
gcc/tree-ssa-dom.c
gcc/tree-ssa-phiopt.c
gcc/tree-ssa.c
gcc/tree.c
gcc/tree.h

index c249c02f4f7538b58e3a6cd2aa5a9ae573b9c546..95ae7a726177cb10b812ccd420e221321018b1ca 100644 (file)
@@ -1,3 +1,11 @@
+2004-11-27  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * tree.c (operand_equal_for_phi_arg_p): New.
+       * tree.h: Add a prototype for operand_equal_for_phi_arg_p.
+       * tree-cfg.c, tree-ssa-dom.c, tree-ssa-phiopt.c, tree-ssa.c:
+       Replace operand_equal_p with operand_for_phi_arg_p
+       appropriately.
+
 2004-11-27  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        PR pch/14940
index bcf3d3e053564d33f3cacbfc59d10c021d38dcd4..37a6920b34cf532466fd72711cad83e5df0481f1 100644 (file)
@@ -2278,7 +2278,7 @@ phi_alternatives_equal (basic_block dest, edge e1, edge e2)
       val1 = PHI_ARG_DEF (phi, n1);
       val2 = PHI_ARG_DEF (phi, n2);
 
-      if (!operand_equal_p (val1, val2, 0))
+      if (!operand_equal_for_phi_arg_p (val1, val2))
        return false;
     }
 
index 5af8489fa41855cf66db302fe6f4929dce5f1e10..a2d145922b536289d320a1c89060f156abfb6dea 100644 (file)
@@ -1180,7 +1180,7 @@ record_equivalences_from_phis (basic_block bb)
          if (TREE_CODE (t) == SSA_NAME || is_gimple_min_invariant (t))
            {
              /* Ignore alternatives which are the same as our LHS.  */
-             if (operand_equal_p (lhs, t, 0))
+             if (operand_equal_for_phi_arg_p (lhs, t))
                continue;
 
              /* If we have not processed an alternative yet, then set
@@ -1190,7 +1190,7 @@ record_equivalences_from_phis (basic_block bb)
              /* If we have processed an alternative (stored in RHS), then
                 see if it is equal to this one.  If it isn't, then stop
                 the search.  */
-             else if (! operand_equal_p (rhs, t, 0))
+             else if (! operand_equal_for_phi_arg_p (rhs, t))
                break;
            }
          else
index 3c241e43fc54de713d0f7560e547ceaa3c5d2b31..b6cfa7a028c2e5472571c195e5b3d4098f224fbc 100644 (file)
@@ -450,10 +450,10 @@ value_replacement (basic_block bb, tree phi, tree arg0, tree arg1)
      We now need to verify that the two arguments in the PHI node match
      the two arguments to the equality comparison.  */
   
-  if ((operand_equal_p (arg0, TREE_OPERAND (cond, 0), 0)
-       && operand_equal_p (arg1, TREE_OPERAND (cond, 1), 0))
-      || (operand_equal_p (arg1, TREE_OPERAND (cond, 0), 0)
-         && operand_equal_p (arg0, TREE_OPERAND (cond, 1), 0)))
+  if ((operand_equal_for_phi_arg_p (arg0, TREE_OPERAND (cond, 0))
+       && operand_equal_for_phi_arg_p (arg1, TREE_OPERAND (cond, 1)))
+      || (operand_equal_for_phi_arg_p (arg1, TREE_OPERAND (cond, 0))
+         && operand_equal_for_phi_arg_p (arg0, TREE_OPERAND (cond, 1))))
     {
       edge e;
       tree arg;
index 4aa8b26cc46a8de112497eba26cceabaa8719585..adb6a51fbdf89dfdb1e246b3b8e579ab2327e26d 100644 (file)
@@ -1138,7 +1138,7 @@ check_phi_redundancy (tree phi, tree *eq_to)
        }
 
       if (val
-         && !operand_equal_p (val, def, 0))
+         && !operand_equal_for_phi_arg_p (val, def))
        return;
 
       val = def;
index 9fb3628261d6c2ac7d8814c43d6be7b1c477a967..961dfb8ff393f52efc6d966c4abc7c23f356fbfc 100644 (file)
@@ -6150,4 +6150,20 @@ lower_bound_in_type (tree outer, tree inner)
                       build_int_cst_wide (inner, lo, hi));
 }
 
+/* Return nonzero if two operands that are suitable for PHI nodes are
+   necessarily equal.  Specifically, both ARG0 and ARG1 must be either
+   SSA_NAME or invariant.  Note that this is strictly an optimization.
+   That is, callers of this function can directly call operand_equal_p
+   and get the same result, only slower.  */
+
+int
+operand_equal_for_phi_arg_p (tree arg0, tree arg1)
+{
+  if (arg0 == arg1)
+    return 1;
+  if (TREE_CODE (arg0) == SSA_NAME || TREE_CODE (arg1) == SSA_NAME)
+    return 0;
+  return operand_equal_p (arg0, arg1, 0);
+}
+
 #include "gt-tree.h"
index 0f109a0c34b9e3d3e3df241b0dda37e4a3401039..b9ce3acd965e14052738794207b5ead50a6eaec2 100644 (file)
@@ -3442,6 +3442,7 @@ extern bool commutative_tree_code (enum tree_code);
 extern tree get_case_label (tree);
 extern tree upper_bound_in_type (tree, tree);
 extern tree lower_bound_in_type (tree, tree);
+extern int operand_equal_for_phi_arg_p (tree, tree);
 \f
 /* In stmt.c */