[tree-ssa] conversion between dissimilar-sized pointers is not useless

Richard Guenther richard.guenther@gmail.com
Wed Mar 9 09:51:00 GMT 2011


On Wed, Mar 9, 2011 at 4:44 AM, DJ Delorie <dj@redhat.com> wrote:
>
> Affects tpf, mips64, and m32c.  Hand-checked tpf by inspection, m32c
> tests running now.  Look OK so far?
>
>        * tree-ssa.c (useless_type_conversion_p): Conversions between
>        pointers of different modes are not useless.
>
> Index: tree-ssa.c
> ===================================================================
> --- tree-ssa.c  (revision 170807)
> +++ tree-ssa.c  (working copy)
> @@ -1227,6 +1227,14 @@
>          != TYPE_ADDR_SPACE (TREE_TYPE (inner_type)))
>        return false;
>
> +      /* Some targets support multiple pointer sizes, others support
> +        partial-int modes for some pointer types.  Do not lose casts
> +        between these.  */
> +      if (TYPE_SIZE (inner_type) != TYPE_SIZE (outer_type)
> +         || (GET_MODE_CLASS (TYPE_MODE (inner_type))
> +             != GET_MODE_CLASS (TYPE_MODE (outer_type))))
> +       return false;

Why not simply

  if (TYPE_MODE (inner_type) != TYPE_MODE (outer_type))
    return false;

?  This only breaks because of the VOID_TYPE_P check below,
right?

Richard.

>       /* Do not lose casts to restrict qualified pointers.  */
>       if ((TYPE_RESTRICT (outer_type)
>           != TYPE_RESTRICT (inner_type))
>



More information about the Gcc-patches mailing list