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
This commit is contained in:
parent
a207780f9b
commit
019b02f12f
2 changed files with 28 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue