+2009-04-17 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-dom.c (gimple_assign_unary_useless_conversion_p): Remove.
+ (record_equivalences_from_stmt): Remove useless checks and
+ simplifications.
+ * tree-ssa-pre.c (eliminate): Avoid converting a constant if
+ the type is already suitable.
+
2009-04-17 Paolo Bonzini <bonzini@gnu.org>
* config/sh/sh.h (FUNCTION_VALUE): Fix call to sh_promote_prototypes.
return retval;
}
-/* Return true if statement GS is an assignment that peforms a useless
- type conversion. It is is intended to be a tuples analog of function
- tree_ssa_useless_type_conversion. */
-
-static bool
-gimple_assign_unary_useless_conversion_p (gimple gs)
-{
- if (is_gimple_assign (gs)
- && (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (gs))
- || gimple_assign_rhs_code (gs) == VIEW_CONVERT_EXPR
- || gimple_assign_rhs_code (gs) == NON_LVALUE_EXPR))
- {
- tree lhs_type = TREE_TYPE (gimple_assign_lhs (gs));
- tree rhs_type = TREE_TYPE (gimple_assign_rhs1 (gs));
- return useless_type_conversion_p (lhs_type, rhs_type);
- }
-
- return false;
-}
-
/* STMT, a GIMPLE_ASSIGN, may create certain equivalences, in either
the available expressions table or the const_and_copies table.
Detect and record those equivalences. */
lhs_code = TREE_CODE (lhs);
if (lhs_code == SSA_NAME
- && (gimple_assign_single_p (stmt)
- || gimple_assign_unary_useless_conversion_p (stmt)))
+ && gimple_assign_single_p (stmt))
{
tree rhs = gimple_assign_rhs1 (stmt);
- /* Strip away any useless type conversions. */
- STRIP_USELESS_TYPE_CONVERSION (rhs);
-
/* If the RHS of the assignment is a constant or another variable that
may be propagated, register it in the CONST_AND_COPIES table. We
do not need to record unwind data for this, since this is a true
value is constant, use that constant. */
if (!sprime && is_gimple_min_invariant (VN_INFO (lhs)->valnum))
{
- sprime = fold_convert (TREE_TYPE (lhs),
- VN_INFO (lhs)->valnum);
+ sprime = VN_INFO (lhs)->valnum;
+ if (!useless_type_conversion_p (TREE_TYPE (lhs),
+ TREE_TYPE (sprime)))
+ sprime = fold_convert (TREE_TYPE (lhs), sprime);
if (dump_file && (dump_flags & TDF_DETAILS))
{