This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Do not use TYPE_CANONICAL in useless_type_conversion
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Bernd Schmidt <bschmidt at redhat dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, Eric Botcazou <ebotcazou at adacore dot com>, gcc-patches at gcc dot gnu dot org, Richard Biener <rguenther at suse dot de>, law at redhat dot com
- Date: Mon, 5 Oct 2015 17:34:58 +0200
- Subject: Re: Do not use TYPE_CANONICAL in useless_type_conversion
- Authentication-results: sourceware.org; auth=none
- References: <20150930211235 dot GB30640 at kam dot mff dot cuni dot cz> <20151002160245 dot GA84720 at kam dot mff dot cuni dot cz> <20151002180022 dot GA32564 at kam dot mff dot cuni dot cz> <11111201 dot hIrLzgQcuo at polaris> <20151002214127 dot GC84720 at kam dot mff dot cuni dot cz> <20151002215225 dot GA14667 at kam dot mff dot cuni dot cz> <56126C73 dot 4070205 at redhat dot com>
> >+ /* For aggregates compare only the size and mode. Accesses to fields do have
> >+ a type information by themselves and thus we only care if we can i.e.
> >+ use the types in move operations. */
> > else if (AGGREGATE_TYPE_P (inner_type)
> > && TREE_CODE (inner_type) == TREE_CODE (outer_type))
> >- return false;
> >+ return (!TYPE_SIZE (outer_type)
> >+ || (TYPE_SIZE (inner_type)
> >+ && operand_equal_p (TYPE_SIZE (inner_type),
> >+ TYPE_SIZE (outer_type), 0)));
> >+
> >+ else if (TREE_CODE (inner_type) == OFFSET_TYPE
> >+ && TREE_CODE (inner_type) == TREE_CODE (outer_type))
> >+ return useless_type_conversion_p (TREE_TYPE (outer_type),
> >+ TREE_TYPE (inner_type))
> >+ && useless_type_conversion_p
> >+ (TYPE_OFFSET_BASETYPE (outer_type),
> >+ TYPE_OFFSET_BASETYPE (inner_type));
> >
>
> The comment says the mode is compared, but I don't see that in the
> code. Which is right?
>
> Also, wouldn't the final condition be clearer written as
>
> > + else if (TREE_CODE (inner_type) == OFFSET_TYPE
> > + && TREE_CODE (outer_type) == OFFSET_TYPE)
Updated in my local copy, thanks!
Honza
>
>
> Bernd