* 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
+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
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;
}
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
/* 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
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;
}
if (val
- && !operand_equal_p (val, def, 0))
+ && !operand_equal_for_phi_arg_p (val, def))
return;
val = def;
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"
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 */