[PATCH] Fold &VIEW_CONVERT_EXPR
Richard Guenther
richard.guenther@gmail.com
Wed May 20 08:47:00 GMT 2009
On Wed, May 20, 2009 at 9:06 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> the transformation &VIEW_CONVERT_EXPR -> (type *)& is already applied during
> gimplification (in gimplify_addr_expr) but it is also needed during IVOPTS to
> avoid computing skewed costs for address IVs.
>
> Tested on x86_64-suse-linux, OK for mainline?
Ok if you use
+ else if (TREE_CODE (t) == VIEW_CONVERT_EXPR)
+ {
+ t = build_fold_addr_expr (TREE_OPERAND (t, 0));
+
+ if (TREE_TYPE (t) != ptrtype)
+ t = build1 (NOP_EXPR, ptrtype, t);
t = fold_convert (ptrtype, t);
as there are optimizations we can apply to avoid the conversion
in some cases.
Thanks,
Richard.
>
> 2009-05-20 Eric Botcazou <ebotcazou@adacore.com>
>
> * fold-const.c (build_fold_addr_expr_with_type): Take the address of
> the operand of VIEW_CONVERT_EXPR.
>
>
> --
> Eric Botcazou
>
More information about the Gcc-patches
mailing list