aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/tree-ssa-dom.c28
2 files changed, 28 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c793e5e..7064c97 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2005-07-12 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR tree-opt/22335
+ * tree-ssa-dom.c (eliminate_redundant_computations): Reject the prop if
+ requiring a cast in a non RHS of modify_expr. Add a cast when required.
+ (lookup_avail_expr): Use constant_boolean_node instead
+ of boolean_false_node/boolean_true_node.
+
2005-07-12 Ben Elliston <bje@au.ibm.com>
* tree-cfg.c (dump_cfg_stats): Add a new fmt_str_2 format string
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index e341a68..1b8b8f1 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -2506,6 +2506,7 @@ eliminate_redundant_computations (tree stmt, stmt_ann_t ann)
bool insert = true;
tree cached_lhs;
bool retval = false;
+ bool modify_expr_p = false;
if (TREE_CODE (stmt) == MODIFY_EXPR)
def = TREE_OPERAND (stmt, 0);
@@ -2547,9 +2548,15 @@ eliminate_redundant_computations (tree stmt, stmt_ann_t ann)
else if (TREE_CODE (stmt) == SWITCH_EXPR)
expr_p = &SWITCH_COND (stmt);
else if (TREE_CODE (stmt) == RETURN_EXPR && TREE_OPERAND (stmt, 0))
- expr_p = &TREE_OPERAND (TREE_OPERAND (stmt, 0), 1);
+ {
+ expr_p = &TREE_OPERAND (TREE_OPERAND (stmt, 0), 1);
+ modify_expr_p = true;
+ }
else
- expr_p = &TREE_OPERAND (stmt, 1);
+ {
+ expr_p = &TREE_OPERAND (stmt, 1);
+ modify_expr_p = true;
+ }
/* It is safe to ignore types here since we have already done
type checking in the hashing and equality routines. In fact
@@ -2557,7 +2564,10 @@ eliminate_redundant_computations (tree stmt, stmt_ann_t ann)
propagation. Also, make sure that it is safe to propagate
CACHED_LHS into *EXPR_P. */
if (cached_lhs
- && (TREE_CODE (cached_lhs) != SSA_NAME
+ && ((TREE_CODE (cached_lhs) != SSA_NAME
+ && (modify_expr_p
+ || tree_ssa_useless_type_conversion_1 (TREE_TYPE (*expr_p),
+ TREE_TYPE (cached_lhs))))
|| may_propagate_copy (*expr_p, cached_lhs)))
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2580,6 +2590,11 @@ eliminate_redundant_computations (tree stmt, stmt_ann_t ann)
|| (POINTER_TYPE_P (TREE_TYPE (*expr_p))
&& is_gimple_min_invariant (cached_lhs)))
retval = true;
+
+ if (modify_expr_p
+ && !tree_ssa_useless_type_conversion_1 (TREE_TYPE (*expr_p),
+ TREE_TYPE (cached_lhs)))
+ cached_lhs = fold_convert (TREE_TYPE (*expr_p), cached_lhs);
propagate_tree_value (expr_p, cached_lhs);
mark_stmt_modified (stmt);
@@ -3088,11 +3103,8 @@ lookup_avail_expr (tree stmt, bool insert)
{
tree t = element->rhs;
free (element);
-
- if (TREE_CODE (t) == EQ_EXPR)
- return boolean_false_node;
- else
- return boolean_true_node;
+ return constant_boolean_node (TREE_CODE (t) != EQ_EXPR,
+ TREE_TYPE (element->rhs));
}
}