RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10))

Richard Guenther richard.guenther@gmail.com
Thu Jun 16 07:39:00 GMT 2011


On Wed, Jun 15, 2011 at 7:46 PM, Mike Stump <mikestump@comcast.net> wrote:
> On Jun 15, 2011, at 2:04 AM, Richard Guenther wrote:
>> This VIEW_CONVERT_EXPR looks useless - in fact useless_type_conversion_p
>> will tell you that, so you can omit it.
>
> So, I tracked down who created it:
>
> tree
> convert_to_vector (tree type, tree expr)
> {
>  switch (TREE_CODE (TREE_TYPE (expr)))
>    {
>    case INTEGER_TYPE:
>    case VECTOR_TYPE:
>      if (!tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (TREE_TYPE (expr))))
>        {
>          error ("can%'t convert between vector values of different size");
>          return error_mark_node;
>        }
> =>    return build1 (VIEW_CONVERT_EXPR, type, expr);
>
> If people want to not create useless conversions in the first place, though, I suspect there are lots of places that create useless conversions in the compiler.

Yeah, the above looks it comes from the frontends - gimplification
should strip this conversion, if it doesn't that is a bug ;)

Richard.



More information about the Gcc-patches mailing list