Commit 019b02f1 by Andrew Pinski Committed by Andrew Pinski

re PR tree-optimization/22335 (DOM creates mis-matched types)

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.

From-SVN: r101929
parent a207780f
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> 2005-07-12 Ben Elliston <bje@au.ibm.com>
* tree-cfg.c (dump_cfg_stats): Add a new fmt_str_2 format string * tree-cfg.c (dump_cfg_stats): Add a new fmt_str_2 format string
......
...@@ -2506,6 +2506,7 @@ eliminate_redundant_computations (tree stmt, stmt_ann_t ann) ...@@ -2506,6 +2506,7 @@ eliminate_redundant_computations (tree stmt, stmt_ann_t ann)
bool insert = true; bool insert = true;
tree cached_lhs; tree cached_lhs;
bool retval = false; bool retval = false;
bool modify_expr_p = false;
if (TREE_CODE (stmt) == MODIFY_EXPR) if (TREE_CODE (stmt) == MODIFY_EXPR)
def = TREE_OPERAND (stmt, 0); def = TREE_OPERAND (stmt, 0);
...@@ -2547,9 +2548,15 @@ eliminate_redundant_computations (tree stmt, stmt_ann_t ann) ...@@ -2547,9 +2548,15 @@ eliminate_redundant_computations (tree stmt, stmt_ann_t ann)
else if (TREE_CODE (stmt) == SWITCH_EXPR) else if (TREE_CODE (stmt) == SWITCH_EXPR)
expr_p = &SWITCH_COND (stmt); expr_p = &SWITCH_COND (stmt);
else if (TREE_CODE (stmt) == RETURN_EXPR && TREE_OPERAND (stmt, 0)) 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 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 /* It is safe to ignore types here since we have already done
type checking in the hashing and equality routines. In fact type checking in the hashing and equality routines. In fact
...@@ -2557,7 +2564,10 @@ eliminate_redundant_computations (tree stmt, stmt_ann_t ann) ...@@ -2557,7 +2564,10 @@ eliminate_redundant_computations (tree stmt, stmt_ann_t ann)
propagation. Also, make sure that it is safe to propagate propagation. Also, make sure that it is safe to propagate
CACHED_LHS into *EXPR_P. */ CACHED_LHS into *EXPR_P. */
if (cached_lhs 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))) || may_propagate_copy (*expr_p, cached_lhs)))
{ {
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
...@@ -2581,6 +2591,11 @@ eliminate_redundant_computations (tree stmt, stmt_ann_t ann) ...@@ -2581,6 +2591,11 @@ eliminate_redundant_computations (tree stmt, stmt_ann_t ann)
&& is_gimple_min_invariant (cached_lhs))) && is_gimple_min_invariant (cached_lhs)))
retval = true; 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); propagate_tree_value (expr_p, cached_lhs);
mark_stmt_modified (stmt); mark_stmt_modified (stmt);
} }
...@@ -3088,11 +3103,8 @@ lookup_avail_expr (tree stmt, bool insert) ...@@ -3088,11 +3103,8 @@ lookup_avail_expr (tree stmt, bool insert)
{ {
tree t = element->rhs; tree t = element->rhs;
free (element); free (element);
return constant_boolean_node (TREE_CODE (t) != EQ_EXPR,
if (TREE_CODE (t) == EQ_EXPR) TREE_TYPE (element->rhs));
return boolean_false_node;
else
return boolean_true_node;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment