Commit 39e45653 by Jeff Law Committed by Jeff Law

tree-ssa-dom.c (record_equivalences_from_incoming_edge): Rework slightly to…

tree-ssa-dom.c (record_equivalences_from_incoming_edge): Rework slightly to avoid creating and folding useless trees.

        * tree-ssa-dom.c (record_equivalences_from_incoming_edge): Rework
	slightly to avoid creating and folding useless trees.  Simplify
        slightly by restricting to INTEGER_CSTs and using int_fits_type_p.

From-SVN: r197060
parent 85d8c21e
2013-03-25 Jeff Law <law@redhat.com>
* tree-ssa-dom.c (record_equivalences_from_incoming_edge): Rework
slightly to avoid creating and folding useless trees. Simplify
slightly by restricting to INTEGER_CSTs and using int_fits_type_p.
2013-03-25 Uros Bizjak <ubizjak@gmail.com> 2013-03-25 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (*zero_extendsidi2): Merge with * config/i386/i386.md (*zero_extendsidi2): Merge with
......
...@@ -1135,12 +1135,13 @@ record_equivalences_from_incoming_edge (basic_block bb) ...@@ -1135,12 +1135,13 @@ record_equivalences_from_incoming_edge (basic_block bb)
if (lhs) if (lhs)
record_equality (lhs, rhs); record_equality (lhs, rhs);
/* If LHS is an SSA_NAME and RHS is a constant and LHS was set /* If LHS is an SSA_NAME and RHS is a constant integer and LHS was
via a widening type conversion, then we may be able to record set via a widening type conversion, then we may be able to record
additional equivalences. */ additional equivalences. */
if (lhs if (lhs
&& TREE_CODE (lhs) == SSA_NAME && TREE_CODE (lhs) == SSA_NAME
&& is_gimple_constant (rhs)) && is_gimple_constant (rhs)
&& TREE_CODE (rhs) == INTEGER_CST)
{ {
gimple defstmt = SSA_NAME_DEF_STMT (lhs); gimple defstmt = SSA_NAME_DEF_STMT (lhs);
...@@ -1149,16 +1150,14 @@ record_equivalences_from_incoming_edge (basic_block bb) ...@@ -1149,16 +1150,14 @@ record_equivalences_from_incoming_edge (basic_block bb)
&& CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (defstmt))) && CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (defstmt)))
{ {
tree old_rhs = gimple_assign_rhs1 (defstmt); tree old_rhs = gimple_assign_rhs1 (defstmt);
tree newval = fold_convert (TREE_TYPE (old_rhs), rhs);
/* If the constant is in the range of the type of OLD_RHS,
/* If this was a widening conversion and if RHS is converted then convert the constant and record the equivalence. */
to the type of OLD_RHS and has the same value, then we if (int_fits_type_p (rhs, TREE_TYPE (old_rhs)))
can record an equivalence between OLD_RHS and the {
converted representation of RHS. */ tree newval = fold_convert (TREE_TYPE (old_rhs), rhs);
if ((TYPE_PRECISION (TREE_TYPE (lhs)) record_equality (old_rhs, newval);
> TYPE_PRECISION (TREE_TYPE (old_rhs))) }
&& operand_equal_p (rhs, newval, 0))
record_equality (old_rhs, newval);
} }
} }
......
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