This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fold &VIEW_CONVERT_EXPR
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 20 May 2009 10:47:34 +0200
- Subject: Re: [PATCH] Fold &VIEW_CONVERT_EXPR
- References: <200905200906.18482.ebotcazou@adacore.com>
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
>