On 03/21/2013 03:44 AM, Richard Biener wrote:
+
+ if (defstmt
+ && is_gimple_assign (defstmt)
+ && 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);
You want to delay that folding and creating of a new tree node until after ...
[ ... ]
Can't hurt.
+ && operand_equal_p (rhs, newval, 0))
If you'd restricted yourself to handling INTEGER_CSTs then using
int_fits_type_p (rhs, TREE_TYPE (lhs)) would have been enough to check.
And operand_equal_p will never return for non-equal typed non-INTEGER_CSTs
anyway ...
Right. I guess it couldn't hurt to filter out anything not an
INTEGER_CST earlier. While it wouldn't change the ultimate result, it
does make it clearer to the reader that this doesn't happen for
non-integer types.
jeff