summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-25 19:05:57 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-25 19:05:57 +0000
commit5aa2495016c0a818687c144034572fe29406cd72 (patch)
treebadb3924bcf639adf7313e2d437082f425cefaed
parentdb79a293a22dfc007eef0cd4e144f655eb8ff055 (diff)
downloadppe42-gcc-5aa2495016c0a818687c144034572fe29406cd72.tar.gz
ppe42-gcc-5aa2495016c0a818687c144034572fe29406cd72.zip
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197060 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/tree-ssa-dom.c25
2 files changed, 18 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9bdf1e5356c..9db06293e44 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+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>
* config/i386/i386.md (*zero_extendsidi2): Merge with
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 57b814c49b3..a71c6dcdfbb 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1135,12 +1135,13 @@ record_equivalences_from_incoming_edge (basic_block bb)
if (lhs)
record_equality (lhs, rhs);
- /* If LHS is an SSA_NAME and RHS is a constant and LHS was set
- via a widening type conversion, then we may be able to record
+ /* If LHS is an SSA_NAME and RHS is a constant integer and LHS was
+ set via a widening type conversion, then we may be able to record
additional equivalences. */
if (lhs
&& 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);
@@ -1149,16 +1150,14 @@ record_equivalences_from_incoming_edge (basic_block bb)
&& CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (defstmt)))
{
tree old_rhs = gimple_assign_rhs1 (defstmt);
- tree newval = fold_convert (TREE_TYPE (old_rhs), rhs);
-
- /* If this was a widening conversion and if RHS is converted
- to the type of OLD_RHS and has the same value, then we
- can record an equivalence between OLD_RHS and the
- converted representation of RHS. */
- if ((TYPE_PRECISION (TREE_TYPE (lhs))
- > TYPE_PRECISION (TREE_TYPE (old_rhs)))
- && operand_equal_p (rhs, newval, 0))
- record_equality (old_rhs, newval);
+
+ /* If the constant is in the range of the type of OLD_RHS,
+ then convert the constant and record the equivalence. */
+ if (int_fits_type_p (rhs, TREE_TYPE (old_rhs)))
+ {
+ tree newval = fold_convert (TREE_TYPE (old_rhs), rhs);
+ record_equality (old_rhs, newval);
+ }
}
}
OpenPOWER on IntegriCloud