From: Richard Biener <richard.guenther@gmail.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>, richard.sandiford@arm.com
Subject: Re: [34/46] Alter interface to vect_get_vec_def_for_stmt_copy
Date: Wed, 25 Jul 2018 10:13:00 -0000 [thread overview]
Message-ID: <CAFiYyc1+WwWUQxOhEPw=zy+Tdohtwx0qPf1rWNvxCrtTbbcgZg@mail.gmail.com> (raw)
In-Reply-To: <87tvoplzh8.fsf@arm.com>
On Tue, Jul 24, 2018 at 12:06 PM Richard Sandiford
<richard.sandiford@arm.com> wrote:
>
> This patch makes vect_get_vec_def_for_stmt_copy take a vec_info
> rather than a vect_def_type. If the vector operand passed in is
> defined in the vectorised region, we should look for copies in
> the normal way. If it's defined in an external statement
> (such as by vect_init_vector_1) we should just use the original value.
Ok, that works for non-SLP (which this is all about).
Would be nice to refactor this to a iterator interface somehow...
> 2018-07-24 Richard Sandiford <richard.sandiford@arm.com>
>
> gcc/
> * tree-vectorizer.h (vect_get_vec_defs_for_stmt_copy)
> (vect_get_vec_def_for_stmt_copy): Take a vec_info rather than
> a vect_def_type for the first argument.
> * tree-vect-stmts.c (vect_get_vec_defs_for_stmt_copy): Likewise.
> (vect_get_vec_def_for_stmt_copy): Likewise. Return the original
> operand if it isn't defined by a vectorized statement.
> (vect_build_gather_load_calls): Remove the mask_dt argument and
> update calls to vect_get_vec_def_for_stmt_copy.
> (vectorizable_bswap): Likewise the dt argument.
> (vectorizable_call): Update calls to vectorizable_bswap and
> vect_get_vec_def_for_stmt_copy.
> (vectorizable_simd_clone_call, vectorizable_assignment)
> (vectorizable_shift, vectorizable_operation, vectorizable_condition)
> (vectorizable_comparison): Update calls to
> vect_get_vec_def_for_stmt_copy.
> (vectorizable_store): Likewise. Remove now-unnecessary calls to
> vect_is_simple_use.
> (vect_get_loop_based_defs): Remove dt argument and update call
> to vect_get_vec_def_for_stmt_copy.
> (vectorizable_conversion): Update calls to vect_get_loop_based_defs
> and vect_get_vec_def_for_stmt_copy.
> (vectorizable_load): Update calls to vect_build_gather_load_calls
> and vect_get_vec_def_for_stmt_copy.
> * tree-vect-loop.c (vect_create_epilog_for_reduction)
> (vectorizable_reduction, vectorizable_live_operation): Update calls
> to vect_get_vec_def_for_stmt_copy.
>
> Index: gcc/tree-vectorizer.h
> ===================================================================
> --- gcc/tree-vectorizer.h 2018-07-24 10:23:50.008602115 +0100
> +++ gcc/tree-vectorizer.h 2018-07-24 10:23:56.440544995 +0100
> @@ -1514,11 +1514,11 @@ extern tree vect_get_vec_def_for_operand
> extern tree vect_get_vec_def_for_operand (tree, stmt_vec_info, tree = NULL);
> extern void vect_get_vec_defs (tree, tree, stmt_vec_info, vec<tree> *,
> vec<tree> *, slp_tree);
> -extern void vect_get_vec_defs_for_stmt_copy (enum vect_def_type *,
> +extern void vect_get_vec_defs_for_stmt_copy (vec_info *,
> vec<tree> *, vec<tree> *);
> extern tree vect_init_vector (stmt_vec_info, tree, tree,
> gimple_stmt_iterator *);
> -extern tree vect_get_vec_def_for_stmt_copy (enum vect_def_type, tree);
> +extern tree vect_get_vec_def_for_stmt_copy (vec_info *, tree);
> extern bool vect_transform_stmt (stmt_vec_info, gimple_stmt_iterator *,
> bool *, slp_tree, slp_instance);
> extern void vect_remove_stores (stmt_vec_info);
> Index: gcc/tree-vect-stmts.c
> ===================================================================
> --- gcc/tree-vect-stmts.c 2018-07-24 10:23:50.008602115 +0100
> +++ gcc/tree-vect-stmts.c 2018-07-24 10:23:56.440544995 +0100
> @@ -1580,8 +1580,7 @@ vect_get_vec_def_for_operand (tree op, s
> created in case the vectorized result cannot fit in one vector, and several
> copies of the vector-stmt are required. In this case the vector-def is
> retrieved from the vector stmt recorded in the STMT_VINFO_RELATED_STMT field
> - of the stmt that defines VEC_OPRND.
> - DT is the type of the vector def VEC_OPRND.
> + of the stmt that defines VEC_OPRND. VINFO describes the vectorization.
>
> Context:
> In case the vectorization factor (VF) is bigger than the number
> @@ -1625,29 +1624,24 @@ vect_get_vec_def_for_operand (tree op, s
> STMT_VINFO_RELATED_STMT field of 'VS1.0' we obtain the next copy - 'VS1.1',
> and return its def ('vx.1').
> Overall, to create the above sequence this function will be called 3 times:
> - vx.1 = vect_get_vec_def_for_stmt_copy (dt, vx.0);
> - vx.2 = vect_get_vec_def_for_stmt_copy (dt, vx.1);
> - vx.3 = vect_get_vec_def_for_stmt_copy (dt, vx.2); */
> + vx.1 = vect_get_vec_def_for_stmt_copy (vinfo, vx.0);
> + vx.2 = vect_get_vec_def_for_stmt_copy (vinfo, vx.1);
> + vx.3 = vect_get_vec_def_for_stmt_copy (vinfo, vx.2); */
>
> tree
> -vect_get_vec_def_for_stmt_copy (enum vect_def_type dt, tree vec_oprnd)
> +vect_get_vec_def_for_stmt_copy (vec_info *vinfo, tree vec_oprnd)
> {
> - gimple *vec_stmt_for_operand;
> - stmt_vec_info def_stmt_info;
> -
> - /* Do nothing; can reuse same def. */
> - if (dt == vect_external_def || dt == vect_constant_def )
> + stmt_vec_info def_stmt_info = vinfo->lookup_def (vec_oprnd);
> + if (!def_stmt_info)
> + /* Do nothing; can reuse same def. */
> return vec_oprnd;
>
> - vec_stmt_for_operand = SSA_NAME_DEF_STMT (vec_oprnd);
> - def_stmt_info = vinfo_for_stmt (vec_stmt_for_operand);
> + def_stmt_info = STMT_VINFO_RELATED_STMT (def_stmt_info);
> gcc_assert (def_stmt_info);
> - vec_stmt_for_operand = STMT_VINFO_RELATED_STMT (def_stmt_info);
> - gcc_assert (vec_stmt_for_operand);
> - if (gimple_code (vec_stmt_for_operand) == GIMPLE_PHI)
> - vec_oprnd = PHI_RESULT (vec_stmt_for_operand);
> + if (gphi *phi = dyn_cast <gphi *> (def_stmt_info->stmt))
> + vec_oprnd = PHI_RESULT (phi);
> else
> - vec_oprnd = gimple_get_lhs (vec_stmt_for_operand);
> + vec_oprnd = gimple_get_lhs (def_stmt_info->stmt);
> return vec_oprnd;
> }
>
> @@ -1656,19 +1650,19 @@ vect_get_vec_def_for_stmt_copy (enum vec
> stmt. See vect_get_vec_def_for_stmt_copy () for details. */
>
> void
> -vect_get_vec_defs_for_stmt_copy (enum vect_def_type *dt,
> +vect_get_vec_defs_for_stmt_copy (vec_info *vinfo,
> vec<tree> *vec_oprnds0,
> vec<tree> *vec_oprnds1)
> {
> tree vec_oprnd = vec_oprnds0->pop ();
>
> - vec_oprnd = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd);
> + vec_oprnd = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd);
> vec_oprnds0->quick_push (vec_oprnd);
>
> if (vec_oprnds1 && vec_oprnds1->length ())
> {
> vec_oprnd = vec_oprnds1->pop ();
> - vec_oprnd = vect_get_vec_def_for_stmt_copy (dt[1], vec_oprnd);
> + vec_oprnd = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd);
> vec_oprnds1->quick_push (vec_oprnd);
> }
> }
> @@ -2662,7 +2656,7 @@ vect_build_gather_load_calls (stmt_vec_i
> gimple_stmt_iterator *gsi,
> stmt_vec_info *vec_stmt,
> gather_scatter_info *gs_info,
> - tree mask, vect_def_type mask_dt)
> + tree mask)
> {
> loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
> struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
> @@ -2767,8 +2761,8 @@ vect_build_gather_load_calls (stmt_vec_i
> op = vec_oprnd0
> = vect_get_vec_def_for_operand (gs_info->offset, stmt_info);
> else
> - op = vec_oprnd0
> - = vect_get_vec_def_for_stmt_copy (gs_info->offset_dt, vec_oprnd0);
> + op = vec_oprnd0 = vect_get_vec_def_for_stmt_copy (loop_vinfo,
> + vec_oprnd0);
>
> if (!useless_type_conversion_p (idxtype, TREE_TYPE (op)))
> {
> @@ -2791,7 +2785,8 @@ vect_build_gather_load_calls (stmt_vec_i
> if (j == 0)
> vec_mask = vect_get_vec_def_for_operand (mask, stmt_info);
> else
> - vec_mask = vect_get_vec_def_for_stmt_copy (mask_dt, vec_mask);
> + vec_mask = vect_get_vec_def_for_stmt_copy (loop_vinfo,
> + vec_mask);
>
> mask_op = vec_mask;
> if (!useless_type_conversion_p (masktype, TREE_TYPE (vec_mask)))
> @@ -2951,11 +2946,11 @@ vect_get_data_ptr_increment (data_refere
> static bool
> vectorizable_bswap (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
> stmt_vec_info *vec_stmt, slp_tree slp_node,
> - tree vectype_in, enum vect_def_type *dt,
> - stmt_vector_for_cost *cost_vec)
> + tree vectype_in, stmt_vector_for_cost *cost_vec)
> {
> tree op, vectype;
> gcall *stmt = as_a <gcall *> (stmt_info->stmt);
> + vec_info *vinfo = stmt_info->vinfo;
> loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
> unsigned ncopies;
> unsigned HOST_WIDE_INT nunits, num_bytes;
> @@ -3021,7 +3016,7 @@ vectorizable_bswap (stmt_vec_info stmt_i
> if (j == 0)
> vect_get_vec_defs (op, NULL, stmt_info, &vec_oprnds, NULL, slp_node);
> else
> - vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds, NULL);
> + vect_get_vec_defs_for_stmt_copy (vinfo, &vec_oprnds, NULL);
>
> /* Arguments are ready. create the new vector stmt. */
> unsigned i;
> @@ -3301,7 +3296,7 @@ vectorizable_call (stmt_vec_info stmt_in
> || gimple_call_builtin_p (stmt, BUILT_IN_BSWAP32)
> || gimple_call_builtin_p (stmt, BUILT_IN_BSWAP64)))
> return vectorizable_bswap (stmt_info, gsi, vec_stmt, slp_node,
> - vectype_in, dt, cost_vec);
> + vectype_in, cost_vec);
> else
> {
> if (dump_enabled_p ())
> @@ -3450,7 +3445,7 @@ vectorizable_call (stmt_vec_info stmt_in
> = vect_get_vec_def_for_operand (op, stmt_info);
> else
> vec_oprnd0
> - = vect_get_vec_def_for_stmt_copy (dt[i], orig_vargs[i]);
> + = vect_get_vec_def_for_stmt_copy (vinfo, orig_vargs[i]);
>
> orig_vargs[i] = vargs[i] = vec_oprnd0;
> }
> @@ -3582,16 +3577,16 @@ vectorizable_call (stmt_vec_info stmt_in
> vec_oprnd0
> = vect_get_vec_def_for_operand (op, stmt_info);
> vec_oprnd1
> - = vect_get_vec_def_for_stmt_copy (dt[i], vec_oprnd0);
> + = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd0);
> }
> else
> {
> vec_oprnd1 = gimple_call_arg (new_stmt_info->stmt,
> 2 * i + 1);
> vec_oprnd0
> - = vect_get_vec_def_for_stmt_copy (dt[i], vec_oprnd1);
> + = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd1);
> vec_oprnd1
> - = vect_get_vec_def_for_stmt_copy (dt[i], vec_oprnd0);
> + = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd0);
> }
>
> vargs.quick_push (vec_oprnd0);
> @@ -4103,7 +4098,7 @@ vectorizable_simd_clone_call (stmt_vec_i
> vec_oprnd0 = arginfo[i].op;
> if ((m & (k - 1)) == 0)
> vec_oprnd0
> - = vect_get_vec_def_for_stmt_copy (arginfo[i].dt,
> + = vect_get_vec_def_for_stmt_copy (vinfo,
> vec_oprnd0);
> }
> arginfo[i].op = vec_oprnd0;
> @@ -4134,7 +4129,7 @@ vectorizable_simd_clone_call (stmt_vec_i
> = vect_get_vec_def_for_operand (op, stmt_info);
> else
> vec_oprnd0
> - = vect_get_vec_def_for_stmt_copy (arginfo[i].dt,
> + = vect_get_vec_def_for_stmt_copy (vinfo,
> arginfo[i].op);
> arginfo[i].op = vec_oprnd0;
> if (k == 1)
> @@ -4440,9 +4435,9 @@ vect_gen_widened_results_half (enum tree
>
> static void
> vect_get_loop_based_defs (tree *oprnd, stmt_vec_info stmt_info,
> - enum vect_def_type dt, vec<tree> *vec_oprnds,
> - int multi_step_cvt)
> + vec<tree> *vec_oprnds, int multi_step_cvt)
> {
> + vec_info *vinfo = stmt_info->vinfo;
> tree vec_oprnd;
>
> /* Get first vector operand. */
> @@ -4451,12 +4446,12 @@ vect_get_loop_based_defs (tree *oprnd, s
> if (TREE_CODE (TREE_TYPE (*oprnd)) != VECTOR_TYPE)
> vec_oprnd = vect_get_vec_def_for_operand (*oprnd, stmt_info);
> else
> - vec_oprnd = vect_get_vec_def_for_stmt_copy (dt, *oprnd);
> + vec_oprnd = vect_get_vec_def_for_stmt_copy (vinfo, *oprnd);
>
> vec_oprnds->quick_push (vec_oprnd);
>
> /* Get second vector operand. */
> - vec_oprnd = vect_get_vec_def_for_stmt_copy (dt, vec_oprnd);
> + vec_oprnd = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd);
> vec_oprnds->quick_push (vec_oprnd);
>
> *oprnd = vec_oprnd;
> @@ -4464,7 +4459,7 @@ vect_get_loop_based_defs (tree *oprnd, s
> /* For conversion in multiple steps, continue to get operands
> recursively. */
> if (multi_step_cvt)
> - vect_get_loop_based_defs (oprnd, stmt_info, dt, vec_oprnds,
> + vect_get_loop_based_defs (oprnd, stmt_info, vec_oprnds,
> multi_step_cvt - 1);
> }
>
> @@ -4983,7 +4978,7 @@ vectorizable_conversion (stmt_vec_info s
> vect_get_vec_defs (op0, NULL, stmt_info, &vec_oprnds0,
> NULL, slp_node);
> else
> - vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds0, NULL);
> + vect_get_vec_defs_for_stmt_copy (vinfo, &vec_oprnds0, NULL);
>
> FOR_EACH_VEC_ELT (vec_oprnds0, i, vop0)
> {
> @@ -5070,7 +5065,7 @@ vectorizable_conversion (stmt_vec_info s
> }
> else
> {
> - vec_oprnd0 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd0);
> + vec_oprnd0 = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd0);
> vec_oprnds0.truncate (0);
> vec_oprnds0.quick_push (vec_oprnd0);
> if (op_type == binary_op)
> @@ -5078,7 +5073,7 @@ vectorizable_conversion (stmt_vec_info s
> if (code == WIDEN_LSHIFT_EXPR)
> vec_oprnd1 = op1;
> else
> - vec_oprnd1 = vect_get_vec_def_for_stmt_copy (dt[1],
> + vec_oprnd1 = vect_get_vec_def_for_stmt_copy (vinfo,
> vec_oprnd1);
> vec_oprnds1.truncate (0);
> vec_oprnds1.quick_push (vec_oprnd1);
> @@ -5160,8 +5155,7 @@ vectorizable_conversion (stmt_vec_info s
> else
> {
> vec_oprnds0.truncate (0);
> - vect_get_loop_based_defs (&last_oprnd, stmt_info, dt[0],
> - &vec_oprnds0,
> + vect_get_loop_based_defs (&last_oprnd, stmt_info, &vec_oprnds0,
> vect_pow2 (multi_step_cvt) - 1);
> }
>
> @@ -5338,7 +5332,7 @@ vectorizable_assignment (stmt_vec_info s
> if (j == 0)
> vect_get_vec_defs (op, NULL, stmt_info, &vec_oprnds, NULL, slp_node);
> else
> - vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds, NULL);
> + vect_get_vec_defs_for_stmt_copy (vinfo, &vec_oprnds, NULL);
>
> /* Arguments are ready. create the new vector stmt. */
> stmt_vec_info new_stmt_info = NULL;
> @@ -5742,7 +5736,7 @@ vectorizable_shift (stmt_vec_info stmt_i
> slp_node);
> }
> else
> - vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds0, &vec_oprnds1);
> + vect_get_vec_defs_for_stmt_copy (vinfo, &vec_oprnds0, &vec_oprnds1);
>
> /* Arguments are ready. Create the new vector stmt. */
> stmt_vec_info new_stmt_info = NULL;
> @@ -6120,11 +6114,11 @@ vectorizable_operation (stmt_vec_info st
> }
> else
> {
> - vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds0, &vec_oprnds1);
> + vect_get_vec_defs_for_stmt_copy (vinfo, &vec_oprnds0, &vec_oprnds1);
> if (op_type == ternary_op)
> {
> tree vec_oprnd = vec_oprnds2.pop ();
> - vec_oprnds2.quick_push (vect_get_vec_def_for_stmt_copy (dt[2],
> + vec_oprnds2.quick_push (vect_get_vec_def_for_stmt_copy (vinfo,
> vec_oprnd));
> }
> }
> @@ -6533,7 +6527,7 @@ vectorizable_store (stmt_vec_info stmt_i
> if (modifier == WIDEN)
> {
> src = vec_oprnd1
> - = vect_get_vec_def_for_stmt_copy (rhs_dt, vec_oprnd1);
> + = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd1);
> op = permute_vec_elements (vec_oprnd0, vec_oprnd0, perm_mask,
> stmt_info, gsi);
> }
> @@ -6542,8 +6536,7 @@ vectorizable_store (stmt_vec_info stmt_i
> src = permute_vec_elements (vec_oprnd1, vec_oprnd1, perm_mask,
> stmt_info, gsi);
> op = vec_oprnd0
> - = vect_get_vec_def_for_stmt_copy (gs_info.offset_dt,
> - vec_oprnd0);
> + = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd0);
> }
> else
> gcc_unreachable ();
> @@ -6551,10 +6544,9 @@ vectorizable_store (stmt_vec_info stmt_i
> else
> {
> src = vec_oprnd1
> - = vect_get_vec_def_for_stmt_copy (rhs_dt, vec_oprnd1);
> + = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd1);
> op = vec_oprnd0
> - = vect_get_vec_def_for_stmt_copy (gs_info.offset_dt,
> - vec_oprnd0);
> + = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnd0);
> }
>
> if (!useless_type_conversion_p (srctype, TREE_TYPE (src)))
> @@ -6811,11 +6803,8 @@ vectorizable_store (stmt_vec_info stmt_i
> if (slp)
> vec_oprnd = vec_oprnds[j];
> else
> - {
> - vect_is_simple_use (op, vinfo, &rhs_dt);
> - vec_oprnd = vect_get_vec_def_for_stmt_copy (rhs_dt,
> - vec_oprnd);
> - }
> + vec_oprnd = vect_get_vec_def_for_stmt_copy (vinfo,
> + vec_oprnd);
> }
> /* Pun the vector to extract from if necessary. */
> if (lvectype != vectype)
> @@ -7060,19 +7049,17 @@ vectorizable_store (stmt_vec_info stmt_i
> for (i = 0; i < group_size; i++)
> {
> op = oprnds[i];
> - vect_is_simple_use (op, vinfo, &rhs_dt);
> - vec_oprnd = vect_get_vec_def_for_stmt_copy (rhs_dt, op);
> + vec_oprnd = vect_get_vec_def_for_stmt_copy (vinfo, op);
> dr_chain[i] = vec_oprnd;
> oprnds[i] = vec_oprnd;
> }
> if (mask)
> - vec_mask = vect_get_vec_def_for_stmt_copy (mask_dt, vec_mask);
> + vec_mask = vect_get_vec_def_for_stmt_copy (vinfo, vec_mask);
> if (dataref_offset)
> dataref_offset
> = int_const_binop (PLUS_EXPR, dataref_offset, bump);
> else if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
> - vec_offset = vect_get_vec_def_for_stmt_copy (gs_info.offset_dt,
> - vec_offset);
> + vec_offset = vect_get_vec_def_for_stmt_copy (vinfo, vec_offset);
> else
> dataref_ptr = bump_vector_ptr (dataref_ptr, ptr_incr, gsi,
> stmt_info, bump);
> @@ -7680,8 +7667,7 @@ vectorizable_load (stmt_vec_info stmt_in
>
> if (memory_access_type == VMAT_GATHER_SCATTER && gs_info.decl)
> {
> - vect_build_gather_load_calls (stmt_info, gsi, vec_stmt, &gs_info, mask,
> - mask_dt);
> + vect_build_gather_load_calls (stmt_info, gsi, vec_stmt, &gs_info, mask);
> return true;
> }
>
> @@ -8233,13 +8219,12 @@ vectorizable_load (stmt_vec_info stmt_in
> dataref_offset = int_const_binop (PLUS_EXPR, dataref_offset,
> bump);
> else if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
> - vec_offset = vect_get_vec_def_for_stmt_copy (gs_info.offset_dt,
> - vec_offset);
> + vec_offset = vect_get_vec_def_for_stmt_copy (vinfo, vec_offset);
> else
> dataref_ptr = bump_vector_ptr (dataref_ptr, ptr_incr, gsi,
> stmt_info, bump);
> if (mask)
> - vec_mask = vect_get_vec_def_for_stmt_copy (mask_dt, vec_mask);
> + vec_mask = vect_get_vec_def_for_stmt_copy (vinfo, vec_mask);
> }
>
> if (grouped_load || slp_perm)
> @@ -8733,6 +8718,7 @@ vectorizable_condition (stmt_vec_info st
> int reduc_index, slp_tree slp_node,
> stmt_vector_for_cost *cost_vec)
> {
> + vec_info *vinfo = stmt_info->vinfo;
> tree scalar_dest = NULL_TREE;
> tree vec_dest = NULL_TREE;
> tree cond_expr, cond_expr0 = NULL_TREE, cond_expr1 = NULL_TREE;
> @@ -8994,16 +8980,14 @@ vectorizable_condition (stmt_vec_info st
> else
> {
> vec_cond_lhs
> - = vect_get_vec_def_for_stmt_copy (dts[0],
> - vec_oprnds0.pop ());
> + = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnds0.pop ());
> if (!masked)
> vec_cond_rhs
> - = vect_get_vec_def_for_stmt_copy (dts[1],
> - vec_oprnds1.pop ());
> + = vect_get_vec_def_for_stmt_copy (vinfo, vec_oprnds1.pop ());
>
> - vec_then_clause = vect_get_vec_def_for_stmt_copy (dts[2],
> + vec_then_clause = vect_get_vec_def_for_stmt_copy (vinfo,
> vec_oprnds2.pop ());
> - vec_else_clause = vect_get_vec_def_for_stmt_copy (dts[3],
> + vec_else_clause = vect_get_vec_def_for_stmt_copy (vinfo,
> vec_oprnds3.pop ());
> }
>
> @@ -9135,6 +9119,7 @@ vectorizable_comparison (stmt_vec_info s
> stmt_vec_info *vec_stmt, tree reduc_def,
> slp_tree slp_node, stmt_vector_for_cost *cost_vec)
> {
> + vec_info *vinfo = stmt_info->vinfo;
> tree lhs, rhs1, rhs2;
> tree vectype1 = NULL_TREE, vectype2 = NULL_TREE;
> tree vectype = STMT_VINFO_VECTYPE (stmt_info);
> @@ -9331,9 +9316,9 @@ vectorizable_comparison (stmt_vec_info s
> }
> else
> {
> - vec_rhs1 = vect_get_vec_def_for_stmt_copy (dts[0],
> + vec_rhs1 = vect_get_vec_def_for_stmt_copy (vinfo,
> vec_oprnds0.pop ());
> - vec_rhs2 = vect_get_vec_def_for_stmt_copy (dts[1],
> + vec_rhs2 = vect_get_vec_def_for_stmt_copy (vinfo,
> vec_oprnds1.pop ());
> }
>
> Index: gcc/tree-vect-loop.c
> ===================================================================
> --- gcc/tree-vect-loop.c 2018-07-24 10:23:50.004602150 +0100
> +++ gcc/tree-vect-loop.c 2018-07-24 10:23:56.436545030 +0100
> @@ -4421,7 +4421,6 @@ vect_create_epilog_for_reduction (vec<tr
> bool nested_in_vect_loop = false;
> auto_vec<gimple *> new_phis;
> auto_vec<stmt_vec_info> inner_phis;
> - enum vect_def_type dt = vect_unknown_def_type;
> int j, i;
> auto_vec<tree> scalar_results;
> unsigned int group_size = 1, k, ratio;
> @@ -4528,8 +4527,7 @@ vect_create_epilog_for_reduction (vec<tr
> phi_info = STMT_VINFO_RELATED_STMT (phi_info);
> if (nested_in_vect_loop)
> vec_init_def
> - = vect_get_vec_def_for_stmt_copy (initial_def_dt,
> - vec_init_def);
> + = vect_get_vec_def_for_stmt_copy (loop_vinfo, vec_init_def);
> }
>
> /* Set the loop-entry arg of the reduction-phi. */
> @@ -4556,7 +4554,7 @@ vect_create_epilog_for_reduction (vec<tr
>
> /* Set the loop-latch arg for the reduction-phi. */
> if (j > 0)
> - def = vect_get_vec_def_for_stmt_copy (vect_unknown_def_type, def);
> + def = vect_get_vec_def_for_stmt_copy (loop_vinfo, def);
>
> add_phi_arg (phi, def, loop_latch_edge (loop), UNKNOWN_LOCATION);
>
> @@ -4697,7 +4695,7 @@ vect_create_epilog_for_reduction (vec<tr
> new_phis.quick_push (phi);
> else
> {
> - def = vect_get_vec_def_for_stmt_copy (dt, def);
> + def = vect_get_vec_def_for_stmt_copy (loop_vinfo, def);
> STMT_VINFO_RELATED_STMT (prev_phi_info) = phi_info;
> }
>
> @@ -7111,19 +7109,22 @@ vectorizable_reduction (stmt_vec_info st
> vec_oprnds0[0] = gimple_get_lhs (new_stmt_info->stmt);
> else
> vec_oprnds0[0]
> - = vect_get_vec_def_for_stmt_copy (dts[0], vec_oprnds0[0]);
> + = vect_get_vec_def_for_stmt_copy (loop_vinfo,
> + vec_oprnds0[0]);
> if (single_defuse_cycle && reduc_index == 1)
> vec_oprnds1[0] = gimple_get_lhs (new_stmt_info->stmt);
> else
> vec_oprnds1[0]
> - = vect_get_vec_def_for_stmt_copy (dts[1], vec_oprnds1[0]);
> + = vect_get_vec_def_for_stmt_copy (loop_vinfo,
> + vec_oprnds1[0]);
> if (op_type == ternary_op)
> {
> if (single_defuse_cycle && reduc_index == 2)
> vec_oprnds2[0] = gimple_get_lhs (new_stmt_info->stmt);
> else
> vec_oprnds2[0]
> - = vect_get_vec_def_for_stmt_copy (dts[2], vec_oprnds2[0]);
> + = vect_get_vec_def_for_stmt_copy (loop_vinfo,
> + vec_oprnds2[0]);
> }
> }
> }
> @@ -7945,8 +7946,7 @@ vectorizable_live_operation (stmt_vec_in
>
> /* For multiple copies, get the last copy. */
> for (int i = 1; i < ncopies; ++i)
> - vec_lhs = vect_get_vec_def_for_stmt_copy (vect_unknown_def_type,
> - vec_lhs);
> + vec_lhs = vect_get_vec_def_for_stmt_copy (loop_vinfo, vec_lhs);
>
> /* Get the last lane in the vector. */
> bitstart = int_const_binop (MINUS_EXPR, vec_bitsize, bitsize);
next prev parent reply other threads:[~2018-07-25 10:13 UTC|newest]
Thread overview: 108+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-24 9:52 [00/46] Remove vinfo_for_stmt etc Richard Sandiford
2018-07-24 9:52 ` [01/46] Move special cases out of get_initial_def_for_reduction Richard Sandiford
2018-07-25 8:42 ` Richard Biener
2018-07-24 9:53 ` [02/46] Remove dead vectorizable_reduction code Richard Sandiford
2018-07-25 8:43 ` Richard Biener
2018-07-24 9:53 ` [03/46] Remove unnecessary update of NUM_SLP_USES Richard Sandiford
2018-07-25 8:46 ` Richard Biener
2018-07-24 9:54 ` [04/46] Factor out the test for a valid reduction input Richard Sandiford
2018-07-25 8:46 ` Richard Biener
2018-07-24 9:54 ` [05/46] Fix make_ssa_name call in vectorizable_reduction Richard Sandiford
2018-07-25 8:47 ` Richard Biener
2018-07-24 9:55 ` [07/46] Add vec_info::lookup_stmt Richard Sandiford
2018-07-25 9:11 ` Richard Biener
2018-07-24 9:55 ` [08/46] Add vec_info::lookup_def Richard Sandiford
2018-07-25 9:12 ` Richard Biener
2018-07-24 9:55 ` [06/46] Add vec_info::add_stmt Richard Sandiford
2018-07-25 9:10 ` Richard Biener
2018-07-24 9:56 ` [09/46] Add vec_info::lookup_single_use Richard Sandiford
2018-07-25 9:13 ` Richard Biener
2018-07-24 9:57 ` [10/46] Temporarily make stmt_vec_info a class Richard Sandiford
2018-07-25 9:14 ` Richard Biener
2018-07-24 9:57 ` [11/46] Pass back a stmt_vec_info from vect_is_simple_use Richard Sandiford
2018-07-25 9:18 ` Richard Biener
2018-07-24 9:58 ` [14/46] Make STMT_VINFO_VEC_STMT a stmt_vec_info Richard Sandiford
2018-07-25 9:21 ` Richard Biener
2018-07-25 11:03 ` Richard Sandiford
2018-08-02 0:22 ` H.J. Lu
2018-08-02 9:58 ` Richard Sandiford
2018-07-24 9:58 ` [12/46] Make vect_finish_stmt_generation return " Richard Sandiford
2018-07-25 9:19 ` Richard Biener
2018-07-24 9:58 ` [13/46] Make STMT_VINFO_RELATED_STMT " Richard Sandiford
2018-07-25 9:19 ` Richard Biener
2018-07-24 9:59 ` [15/46] Make SLP_TREE_VEC_STMTS a vec<stmt_vec_info> Richard Sandiford
2018-07-25 9:22 ` Richard Biener
2018-07-24 9:59 ` [17/46] Make LOOP_VINFO_REDUCTIONS an auto_vec<stmt_vec_info> Richard Sandiford
2018-07-25 9:23 ` Richard Biener
2018-07-24 9:59 ` [16/46] Make STMT_VINFO_REDUC_DEF a stmt_vec_info Richard Sandiford
2018-07-25 9:22 ` Richard Biener
2018-07-24 10:00 ` [18/46] Make SLP_TREE_SCALAR_STMTS a vec<stmt_vec_info> Richard Sandiford
2018-07-25 9:27 ` Richard Biener
2018-07-31 15:03 ` Richard Sandiford
2018-07-24 10:01 ` [20/46] Make *FIRST_ELEMENT and *NEXT_ELEMENT stmt_vec_infos Richard Sandiford
2018-07-25 9:28 ` Richard Biener
2018-07-24 10:01 ` [21/46] Make grouped_stores and reduction_chains use stmt_vec_infos Richard Sandiford
2018-07-25 9:28 ` Richard Biener
2018-07-24 10:01 ` [19/46] Make vect_dr_stmt return a stmt_vec_info Richard Sandiford
2018-07-25 9:28 ` Richard Biener
2018-07-24 10:02 ` [23/46] Make LOOP_VINFO_MAY_MISALIGN_STMTS use stmt_vec_info Richard Sandiford
2018-07-25 9:29 ` Richard Biener
2018-07-24 10:02 ` [24/46] Make stmt_info_for_cost use a stmt_vec_info Richard Sandiford
2018-07-25 9:30 ` Richard Biener
2018-07-24 10:02 ` [22/46] Make DR_GROUP_SAME_DR_STMT " Richard Sandiford
2018-07-25 9:29 ` Richard Biener
2018-07-24 10:03 ` [27/46] Remove duplicated stmt_vec_info lookups Richard Sandiford
2018-07-25 9:32 ` Richard Biener
2018-07-24 10:03 ` [26/46] Make more use of dyn_cast in tree-vect* Richard Sandiford
2018-07-25 9:31 ` Richard Biener
2018-07-24 10:03 ` [25/46] Make get_earlier/later_stmt take and return stmt_vec_infos Richard Sandiford
2018-07-25 9:31 ` Richard Biener
2018-07-24 10:04 ` [30/46] Use stmt_vec_infos rather than gimple stmts for worklists Richard Sandiford
2018-07-25 10:04 ` Richard Biener
2018-07-24 10:04 ` [28/46] Use stmt_vec_info instead of gimple stmts internally (part 1) Richard Sandiford
2018-07-25 9:33 ` Richard Biener
2018-07-24 10:04 ` [29/46] Use stmt_vec_info instead of gimple stmts internally (part 2) Richard Sandiford
2018-07-25 10:03 ` Richard Biener
2018-07-24 10:05 ` [31/46] Use stmt_vec_info in function interfaces (part 1) Richard Sandiford
2018-07-25 10:05 ` Richard Biener
2018-07-24 10:05 ` [32/46] Use stmt_vec_info in function interfaces (part 2) Richard Sandiford
2018-07-25 10:06 ` Richard Biener
2018-07-24 10:06 ` [35/46] Alter interfaces within vect_pattern_recog Richard Sandiford
2018-07-25 10:14 ` Richard Biener
2018-07-24 10:06 ` [33/46] Use stmt_vec_infos instead of vec_info/gimple stmt pairs Richard Sandiford
2018-07-25 10:06 ` Richard Biener
2018-07-24 10:06 ` [34/46] Alter interface to vect_get_vec_def_for_stmt_copy Richard Sandiford
2018-07-25 10:13 ` Richard Biener [this message]
2018-07-24 10:07 ` [37/46] Associate alignment information with stmt_vec_infos Richard Sandiford
2018-07-25 10:18 ` Richard Biener
2018-07-26 10:55 ` Richard Sandiford
2018-07-26 11:13 ` Richard Biener
2018-07-24 10:07 ` [36/46] Add a pattern_stmt_p field to stmt_vec_info Richard Sandiford
2018-07-25 10:15 ` Richard Biener
2018-07-25 11:09 ` Richard Sandiford
2018-07-25 11:48 ` Richard Biener
2018-07-26 10:29 ` Richard Sandiford
2018-07-26 11:15 ` Richard Biener
2018-07-24 10:08 ` [38/46] Pass stmt_vec_infos instead of data_references where relevant Richard Sandiford
2018-07-25 10:21 ` Richard Biener
2018-07-25 11:21 ` Richard Sandiford
2018-07-26 11:05 ` Richard Sandiford
2018-07-26 11:13 ` Richard Biener
2018-07-24 10:08 ` [39/46] Replace STMT_VINFO_UNALIGNED_DR with the associated statement Richard Sandiford
2018-07-26 11:08 ` [39/46 v2] Change STMT_VINFO_UNALIGNED_DR to a dr_vec_info Richard Sandiford
2018-07-26 11:13 ` Richard Biener
2018-07-24 10:09 ` [41/46] Add vec_info::remove_stmt Richard Sandiford
2018-07-31 12:02 ` Richard Biener
2018-07-24 10:09 ` [42/46] Add vec_info::replace_stmt Richard Sandiford
2018-07-31 12:03 ` Richard Biener
2018-07-24 10:09 ` [40/46] Add vec_info::lookup_dr Richard Sandiford
2018-07-26 11:10 ` [40/46 v2] " Richard Sandiford
2018-07-26 11:16 ` Richard Biener
2018-07-24 10:10 ` [44/46] Remove global vinfo_for_stmt-related routines Richard Sandiford
2018-07-31 12:05 ` Richard Biener
2018-07-24 10:10 ` [45/46] Remove vect_stmt_in_region_p Richard Sandiford
2018-07-31 12:06 ` Richard Biener
2018-07-24 10:10 ` [43/46] Make free_stmt_vec_info take a stmt_vec_info Richard Sandiford
2018-07-31 12:03 ` Richard Biener
2018-07-24 10:11 ` [46/46] Turn stmt_vec_info back into a typedef Richard Sandiford
2018-07-31 12:07 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFiYyc1+WwWUQxOhEPw=zy+Tdohtwx0qPf1rWNvxCrtTbbcgZg@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.sandiford@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).