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

Mike Stump mikestump@comcast.net
Wed Jun 15 18:57:00 GMT 2011


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.



More information about the Gcc-patches mailing list