* tree-ssa-sccvn.c (visit_reference_op_store): Do not insert
struct copies into the expression table.
(simplify_unary_expression): Handle VIEW_CONVERT_EXPR.
(try_to_simplify): Likewise.
* fold-const.c (fold_unary): Fold VIEW_CONVERT_EXPR of
integral and pointer arguments which do not change the
precision to NOP_EXPRs.
* tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Adjust
VIEW_CONVERT_EXPR case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132836
138bc75d-0d04-0410-961f-
82ee72b054a4
+2008-03-03 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-sccvn.c (visit_reference_op_store): Do not insert
+ struct copies into the expression table.
+ (simplify_unary_expression): Handle VIEW_CONVERT_EXPR.
+ (try_to_simplify): Likewise.
+ * fold-const.c (fold_unary): Fold VIEW_CONVERT_EXPR of
+ integral and pointer arguments which do not change the
+ precision to NOP_EXPRs.
+ * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Adjust
+ VIEW_CONVERT_EXPR case.
+
2008-03-02 Sebastian Pop <sebastian.pop@amd.com>
* tree-scalar-evolution.c (instantiate_parameters_1): An SSA_NAME
case VIEW_CONVERT_EXPR:
if (TREE_TYPE (op0) == type)
return op0;
- if (TREE_CODE (op0) == VIEW_CONVERT_EXPR
- || (TREE_CODE (op0) == NOP_EXPR
- && INTEGRAL_TYPE_P (TREE_TYPE (op0))
- && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (op0, 0)))
- && TYPE_PRECISION (TREE_TYPE (op0))
- == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op0, 0)))))
+ if (TREE_CODE (op0) == VIEW_CONVERT_EXPR)
return fold_build1 (VIEW_CONVERT_EXPR, type, TREE_OPERAND (op0, 0));
+
+ /* For integral conversions with the same precision or pointer
+ conversions use a NOP_EXPR instead. */
+ if ((INTEGRAL_TYPE_P (type) && INTEGRAL_TYPE_P (TREE_TYPE (op0))
+ && TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (op0))
+ /* Do not muck with VIEW_CONVERT_EXPRs that convert from
+ a sub-type to its base type as generated by the Ada FE. */
+ && !TREE_TYPE (TREE_TYPE (op0)))
+ || (POINTER_TYPE_P (type) && POINTER_TYPE_P (TREE_TYPE (op0))))
+ return fold_convert (type, op0);
+
+ /* Strip inner integral conversions that do not change the precision. */
+ if ((TREE_CODE (op0) == NOP_EXPR
+ || TREE_CODE (op0) == CONVERT_EXPR)
+ && INTEGRAL_TYPE_P (TREE_TYPE (op0))
+ && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (op0, 0)))
+ && (TYPE_PRECISION (TREE_TYPE (op0))
+ == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op0, 0)))))
+ return fold_build1 (VIEW_CONVERT_EXPR, type, TREE_OPERAND (op0, 0));
+
return fold_view_convert_expr (type, op0);
case NEGATE_EXPR:
and make them look addressable. After some processing the
non-addressability may be uncovered again, causing ADDR_EXPRs
of inappropriate objects to be built. */
- if (AGGREGATE_TYPE_P (TREE_TYPE (expr))
- && !AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0))))
+ if (is_gimple_reg (TREE_OPERAND (expr, 0))
+ || is_gimple_min_invariant (TREE_OPERAND (expr, 0)))
return true;
/* ... fall through ... */
changed |= set_ssa_val_to (vdef, vdef);
}
- vn_reference_insert (lhs, op, vdefs);
+ /* Do not insert structure copies into the tables. */
+ if (is_gimple_min_invariant (op)
+ || is_gimple_reg (op))
+ vn_reference_insert (lhs, op, vdefs);
}
else
{
else if (TREE_CODE (rhs) == NOP_EXPR
|| TREE_CODE (rhs) == CONVERT_EXPR
|| TREE_CODE (rhs) == REALPART_EXPR
- || TREE_CODE (rhs) == IMAGPART_EXPR)
+ || TREE_CODE (rhs) == IMAGPART_EXPR
+ || TREE_CODE (rhs) == VIEW_CONVERT_EXPR)
{
/* We want to do tree-combining on conversion-like expressions.
Make sure we feed only SSA_NAMEs or constants to fold though. */
tree tem = valueize_expr (VN_INFO (op0)->expr);
if (UNARY_CLASS_P (tem)
|| BINARY_CLASS_P (tem)
+ || TREE_CODE (tem) == VIEW_CONVERT_EXPR
|| TREE_CODE (tem) == SSA_NAME
|| is_gimple_min_invariant (tem))
op0 = tem;
/* Fallthrough for some codes that can operate on registers. */
if (!(TREE_CODE (rhs) == REALPART_EXPR
- || TREE_CODE (rhs) == IMAGPART_EXPR))
+ || TREE_CODE (rhs) == IMAGPART_EXPR
+ || TREE_CODE (rhs) == VIEW_CONVERT_EXPR))
break;
/* We could do a little more with unary ops, if they expand
into binary ops, but it's debatable whether it is worth it. */