[PATCH] Fix PR91790 by considering different first_stmt_info for realign
As PR91790 exposed, when we have one slp node whose first_stmt_info_for_drptr is different from first_stmt_info, it's possible that the first_stmt DR isn't initialized yet before stmt SLP_TREE_SCALAR_STMTS[0] of slp node. So we shouldn't use first_stmt_info for vect_setup_realignment, instead we can use the one based on first_stmt_info_for_drptr DR with additional adjustment by bumping the distance from first_stmt DR. 2019-12-10 Kewen Lin <linkw@gcc.gnu.org> Backport from mainline 2019-11-27 Kewen Lin <linkw@gcc.gnu.org> PR tree-optimization/91790 * gcc/tree-vect-stmts.c (vectorizable_load): Use the adjusted DR for vect_setup_realignment when first_stmt_info is different from first_stmt_info_for_drptr. From-SVN: r279166
This commit is contained in:
parent
92df45de27
commit
fdfcc35d8a
@ -1,3 +1,13 @@
|
||||
2019-12-10 Kewen Lin <linkw@gcc.gnu.org>
|
||||
|
||||
Backport from mainline
|
||||
2019-11-27 Kewen Lin <linkw@gcc.gnu.org>
|
||||
|
||||
PR tree-optimization/91790
|
||||
* gcc/tree-vect-stmts.c (vectorizable_load): Use the adjusted DR for
|
||||
vect_setup_realignment when first_stmt_info is different from
|
||||
first_stmt_info_for_drptr.
|
||||
|
||||
2019-12-09 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* tree.c (build_array_type_1): Add SET_CANONICAL parameter and compute
|
||||
|
@ -8272,18 +8272,27 @@ vectorizable_load (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
|
||||
compute_in_loop = true;
|
||||
}
|
||||
|
||||
bool diff_first_stmt_info
|
||||
= first_stmt_info_for_drptr && first_stmt_info != first_stmt_info_for_drptr;
|
||||
|
||||
if ((alignment_support_scheme == dr_explicit_realign_optimized
|
||||
|| alignment_support_scheme == dr_explicit_realign)
|
||||
&& !compute_in_loop)
|
||||
{
|
||||
msq = vect_setup_realignment (first_stmt_info, gsi, &realignment_token,
|
||||
alignment_support_scheme, NULL_TREE,
|
||||
&at_loop);
|
||||
/* If we have different first_stmt_info, we can't set up realignment
|
||||
here, since we can't guarantee first_stmt_info DR has been
|
||||
initialized yet, use first_stmt_info_for_drptr DR by bumping the
|
||||
distance from first_stmt_info DR instead as below. */
|
||||
if (!diff_first_stmt_info)
|
||||
msq = vect_setup_realignment (first_stmt_info, gsi, &realignment_token,
|
||||
alignment_support_scheme, NULL_TREE,
|
||||
&at_loop);
|
||||
if (alignment_support_scheme == dr_explicit_realign_optimized)
|
||||
{
|
||||
phi = as_a <gphi *> (SSA_NAME_DEF_STMT (msq));
|
||||
byte_offset = size_binop (MINUS_EXPR, TYPE_SIZE_UNIT (vectype),
|
||||
size_one_node);
|
||||
gcc_assert (!first_stmt_info_for_drptr);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -8339,8 +8348,7 @@ vectorizable_load (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
|
||||
dataref_ptr = unshare_expr (DR_BASE_ADDRESS (first_dr_info->dr));
|
||||
dataref_offset = build_int_cst (ref_type, 0);
|
||||
}
|
||||
else if (first_stmt_info_for_drptr
|
||||
&& first_stmt_info != first_stmt_info_for_drptr)
|
||||
else if (diff_first_stmt_info)
|
||||
{
|
||||
dataref_ptr
|
||||
= vect_create_data_ref_ptr (first_stmt_info_for_drptr,
|
||||
@ -8357,6 +8365,14 @@ vectorizable_load (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
|
||||
DR_INIT (ptrdr)));
|
||||
dataref_ptr = bump_vector_ptr (dataref_ptr, ptr_incr, gsi,
|
||||
stmt_info, diff);
|
||||
if (alignment_support_scheme == dr_explicit_realign)
|
||||
{
|
||||
msq = vect_setup_realignment (first_stmt_info_for_drptr, gsi,
|
||||
&realignment_token,
|
||||
alignment_support_scheme,
|
||||
dataref_ptr, &at_loop);
|
||||
gcc_assert (!compute_in_loop);
|
||||
}
|
||||
}
|
||||
else if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
|
||||
vect_get_gather_scatter_ops (loop, stmt_info, &gs_info,
|
||||
|
Loading…
Reference in New Issue
Block a user