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: [tree-ssa] conversion between dissimilar-sized pointers is not useless


On Wed, Mar 9, 2011 at 10:51 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> 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?

Oh, btw - I expect that a lot more code will be confused about different
size pointer types, notably IVOPTs and the POINTER_PLUS_EXPR
restriction of only accepting sizetype offsets.

Richard.


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