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: [PATCH] Create VECTOR_CST instead of CONSTRUCTORs where possible in the vectorizer (PR tree-optimization/33993)


These appeared on powerpc64-linux since the commit of this patch (r129920):

FAIL: gcc.dg/vect/no-scevccp-outer-10a.c execution test
FAIL: gcc.dg/vect/no-scevccp-outer-10b.c execution test
FAIL: gcc.dg/vect/no-scevccp-outer-11.c execution test
FAIL: gcc.dg/vect/no-scevccp-outer-12.c execution test
FAIL: gcc.dg/vect/no-scevccp-outer-15.c execution test
FAIL: gcc.dg/vect/no-scevccp-outer-22.c execution test
FAIL: gcc.dg/vect/no-scevccp-outer-7.c execution test
FAIL: gcc.dg/vect/no-scevccp-noreassoc-outer-3.c execution test

dorit

> Hi!
>
> On sparc64-linux gcc ICEs on the attached testcase with -O3, because stmt
> verification doesn't like <VIEW_CONVERT_EXPR <CONSTRUCTOR <...>>, but
> requires a CONSTANT_CLASS_P or is_gimple_lvalue inside of
> handled_component_p.  While that verification should be probably to allow
> CONSTRUCTORs inside of VIEW_CONVERT_EXPR (guess no other
> handled_component_p codes though), or at least some CONSTRUCTORs (which?
> is_gimple_min_invariant ones, or only TREE_CONSTANT ones, only vector
> ones or something else), this exact problem is because vectorizer is lazy
> and creates CONSTRUCTORs even when VECTOR_CSTs should be used instead
> (if these were gimplified, the gimplifier would change them to
VECTOR_CSTs,
> but they are not and also it would be wasteful to create CONSTRUCTORs
only
> to create VECTOR_CSTs from them immediately afterwards).
>
> In vect_get_constant_vectors the parts can actually be sometimes
constants,
> sometimes something else, in the latter hunks I'm fairly certain only
> constants can be seen among the parts - step_expr is an INTEGER_CST
> (otherwise vect_is_simple_iv_evolution would return false and we'd fail
> the assertion after it) and in some cases it is multiplied by another
> INTEGER_CST.
>
> Regtested on x86_64-linux, tested on the testcase on sparc64-linux.
> Ok for trunk?
>
> 2007-11-05  Jakub Jelinek  <jakub@redhat.com>
>
>    PR tree-optimization/33993
>    * tree-vect-transform.c (vect_get_constant_vectors): Use build_vector
>    rather than build_constructor_from_list if all list values are
>    constants.
>    (get_initial_def_for_induction): Use build_vector instead of
>    build_constructor_from_list.
>
>    * gcc.c-torture/compile/20071105-1.c: New test.
>
> --- gcc/tree-vect-transform.c.jj   2007-11-05 09:05:44.000000000 +0100
> +++ gcc/tree-vect-transform.c   2007-11-05 11:41:14.000000000 +0100
> @@ -1318,6 +1318,7 @@ vect_get_constant_vectors (slp_tree slp_
>    bool is_store = false;
>    unsigned int number_of_vectors = SLP_TREE_NUMBER_OF_VEC_STMTS
(slp_node);
>    VEC (tree, heap) *voprnds = VEC_alloc (tree, heap, number_of_vectors);
> +  bool constant_p;
>
>    if (STMT_VINFO_DATA_REF (stmt_vinfo))
>      is_store = true;
> @@ -1341,6 +1342,7 @@ vect_get_constant_vectors (slp_tree slp_
>    number_of_copies = least_common_multiple (nunits, group_size) /
group_size;
>
>    number_of_places_left_in_vector = nunits;
> +  constant_p = true;
>    for (j = 0; j < number_of_copies; j++)
>      {
>        for (i = group_size - 1; VEC_iterate (tree, stmts, i, stmt); i--)
> @@ -1350,6 +1352,8 @@ vect_get_constant_vectors (slp_tree slp_
>         op = operation;
>       else
>         op = TREE_OPERAND (operation, op_num);
> +     if (!CONSTANT_CLASS_P (op))
> +       constant_p = false;
>
>            /* Create 'vect_ = {op0,op1,...,opn}'.  */
>            t = tree_cons (NULL_TREE, op, t);
> @@ -1362,7 +1366,11 @@ vect_get_constant_vectors (slp_tree slp_
>
>           vector_type = get_vectype_for_scalar_type (TREE_TYPE (op));
>                gcc_assert (vector_type);
> -              vec_cst = build_constructor_from_list (vector_type, t);
> +         if (constant_p)
> +      vec_cst = build_vector (vector_type, t);
> +         else
> +      vec_cst = build_constructor_from_list (vector_type, t);
> +         constant_p = true;
>                VEC_quick_push (tree, voprnds,
>                                vect_init_vector (stmt, vec_cst,
vector_type,
>                    NULL));
> @@ -1617,7 +1625,8 @@ get_initial_def_for_induction (tree iv_p
>    t = NULL_TREE;
>    for (i = 0; i < nunits; i++)
>      t = tree_cons (NULL_TREE, unshare_expr (new_name), t);
> -  vec = build_constructor_from_list (vectype, t);
> +  gcc_assert (CONSTANT_CLASS_P (new_name));
> +  vec = build_vector (vectype, t);
>    vec_step = vect_init_vector (iv_phi, vec, vectype, NULL);
>
>
> @@ -1673,7 +1682,8 @@ get_initial_def_for_induction (tree iv_p
>        t = NULL_TREE;
>        for (i = 0; i < nunits; i++)
>     t = tree_cons (NULL_TREE, unshare_expr (new_name), t);
> -      vec = build_constructor_from_list (vectype, t);
> +      gcc_assert (CONSTANT_CLASS_P (new_name));
> +      vec = build_vector (vectype, t);
>        vec_step = vect_init_vector (iv_phi, vec, vectype, NULL);
>
>        vec_def = induc_def;
> --- gcc/testsuite/gcc.c-torture/compile/20071105-1.c.jj   2007-11-05
> 12:54:14.000000000 +0100
> +++ gcc/testsuite/gcc.c-torture/compile/20071105-1.c   2007-11-05
> 12:53:47.000000000 +0100
> @@ -0,0 +1,11 @@
> +/* PR tree-optimization/33993 */
> +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
> +
> +void
> +init_full (char *array, int ny)
> +{
> +  int j;
> +  char acc = 128;
> +  for (j = 0; j < ny; j++)
> +    *array++ = acc++;
> +}
>
>    Jakub


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