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: Do not use TYPE_CANONICAL in useless_type_conversion


> >+  /* 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


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