This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fold &VIEW_CONVERT_EXPR


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
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]