http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45902
--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-10
13:26:39 UTC ---
(In reply to comment #8)
> The problem is in creation of constant operands for SLP, and is caused by my
> patch r155882, which takes the type for the constant from the constant itself.
> This was needed for pointers, but is bad for other cases, like shift of shorts
> that is treated as int here, causing wrong code generation.
>
> I am going to test this patch now:
>
> Index: tree-vect-slp.c
> ===================================================================
> --- tree-vect-slp.c (revision 164987)
> +++ tree-vect-slp.c (working copy)
> @@ -1894,13 +1894,20 @@ vect_get_constant_vectors (slp_tree slp_
> }
>
> if (CONSTANT_CLASS_P (op))
> - constant_p = true;
> + {
> + constant_p = true;
> + if (POINTER_TYPE_P (TREE_TYPE (gimple_assign_lhs (stmt))))
> + vector_type = get_vectype_for_scalar_type (TREE_TYPE (op));
> + else
> + vector_type = STMT_VINFO_VECTYPE (stmt_vinfo);
> + }
> else
> - constant_p = false;
> + {
> + constant_p = false;
> + vector_type = get_vectype_for_scalar_type (TREE_TYPE (op));
> + }
>
> - vector_type = get_vectype_for_scalar_type (TREE_TYPE (op));
> gcc_assert (vector_type);
> -
> nunits = TYPE_VECTOR_SUBPARTS (vector_type);
>
> /* NUMBER_OF_COPIES is the number of times we need to use the same values
> in
I certainly would prefer unconditional use of STMT_VINFO_VECTYPE (stmt_vinfo).
Why should that not work?