Commit 69f8c1ae by Richard Biener Committed by Richard Biener

tree-vectorizer.h (_stmt_vec_info::v_reduc_type): Remove.

2019-10-08  Richard Biener  <rguenther@suse.de>

	* tree-vectorizer.h (_stmt_vec_info::v_reduc_type): Remove.
	(_stmt_vec_info::is_reduc_info): Add.
	(STMT_VINFO_VEC_REDUCTION_TYPE): Remove.
	(vectorizable_condition): Remove.
	(vectorizable_shift): Likewise.
	(vectorizable_reduction): Adjust.
	(info_for_reduction): New.
	* tree-vect-loop.c (vect_force_simple_reduction): Fold into...
	(vect_analyze_scalar_cycles_1): ... here.
	(vect_analyze_loop_operations): Adjust.
	(needs_fold_left_reduction_p): Simplify for single caller.
	(vect_is_simple_reduction): Likewise.  Remove stmt restriction
	for nested cycles not part of double reductions.
	(vect_model_reduction_cost): Pass in the reduction type.
	(info_for_reduction): New function.
	(vect_create_epilog_for_reduction): Use it, access reduction
	meta off the stmt info it returns.  Use STMT_VINFO_REDUC_TYPE
	instead of STMT_VINFO_VEC_REDUCTION_TYPE.
	(vectorize_fold_left_reduction): Remove pointless assert.
	(vectorizable_reduction): Analyze the full reduction when
	visiting the outermost PHI.  Simplify.  Use STMT_VINFO_REDUC_TYPE
	instead of STMT_VINFO_VEC_REDUCTION_TYPE.  Direct reduction
	stmt code-generation to vectorizable_* in most cases.  Verify
	code-generation only for cases handled by
	vect_transform_reductuon.
	(vect_transform_reduction): Use info_for_reduction to get at
	reduction meta.  Simplify.
	(vect_transform_cycle_phi): Likewise.
	(vectorizable_live_operation): Likewise.
	* tree-vect-patterns.c (vect_reassociating_reduction_p): Look
	at the PHI node for STMT_VINFO_REDUC_TYPE.
	* tree-vect-slp.c (vect_schedule_slp_instance): Remove no
	longer necessary code.
	* tree-vect-stmts.c (vectorizable_shift): Make static again.
	(vectorizable_condition): Likewise.  Get at reduction related
	info via info_for_reduction.
	(vect_analyze_stmt): Adjust.
	(vect_transform_stmt): Likewise.
	* tree-vectorizer.c (vec_info::new_stmt_vec_info): Initialize
	STMT_VINFO_REDUC_TYPE instead of STMT_VINFO_VEC_REDUCTION_TYPE.

	* gcc.dg/vect/pr65947-1.c: Adjust.
	* gcc.dg/vect/pr65947-13.c: Likewise.
	* gcc.dg/vect/pr65947-14.c: Likewise.
	* gcc.dg/vect/pr65947-4.c: Likewise.
	* gcc.dg/vect/pr80631-1.c: Likewise.
	* gcc.dg/vect/pr80631-2.c: Likewise.

From-SVN: r276700
parent 65b67cf3
2019-10-08 Richard Biener <rguenther@suse.de>
* tree-vectorizer.h (_stmt_vec_info::v_reduc_type): Remove.
(_stmt_vec_info::is_reduc_info): Add.
(STMT_VINFO_VEC_REDUCTION_TYPE): Remove.
(vectorizable_condition): Remove.
(vectorizable_shift): Likewise.
(vectorizable_reduction): Adjust.
(info_for_reduction): New.
* tree-vect-loop.c (vect_force_simple_reduction): Fold into...
(vect_analyze_scalar_cycles_1): ... here.
(vect_analyze_loop_operations): Adjust.
(needs_fold_left_reduction_p): Simplify for single caller.
(vect_is_simple_reduction): Likewise. Remove stmt restriction
for nested cycles not part of double reductions.
(vect_model_reduction_cost): Pass in the reduction type.
(info_for_reduction): New function.
(vect_create_epilog_for_reduction): Use it, access reduction
meta off the stmt info it returns. Use STMT_VINFO_REDUC_TYPE
instead of STMT_VINFO_VEC_REDUCTION_TYPE.
(vectorize_fold_left_reduction): Remove pointless assert.
(vectorizable_reduction): Analyze the full reduction when
visiting the outermost PHI. Simplify. Use STMT_VINFO_REDUC_TYPE
instead of STMT_VINFO_VEC_REDUCTION_TYPE. Direct reduction
stmt code-generation to vectorizable_* in most cases. Verify
code-generation only for cases handled by
vect_transform_reductuon.
(vect_transform_reduction): Use info_for_reduction to get at
reduction meta. Simplify.
(vect_transform_cycle_phi): Likewise.
(vectorizable_live_operation): Likewise.
* tree-vect-patterns.c (vect_reassociating_reduction_p): Look
at the PHI node for STMT_VINFO_REDUC_TYPE.
* tree-vect-slp.c (vect_schedule_slp_instance): Remove no
longer necessary code.
* tree-vect-stmts.c (vectorizable_shift): Make static again.
(vectorizable_condition): Likewise. Get at reduction related
info via info_for_reduction.
(vect_analyze_stmt): Adjust.
(vect_transform_stmt): Likewise.
* tree-vectorizer.c (vec_info::new_stmt_vec_info): Initialize
STMT_VINFO_REDUC_TYPE instead of STMT_VINFO_VEC_REDUCTION_TYPE.
2019-10-08 Joseph Myers <joseph@codesourcery.com> 2019-10-08 Joseph Myers <joseph@codesourcery.com>
* doc/invoke.texi (-ffp-int-builtin-inexact): Document * doc/invoke.texi (-ffp-int-builtin-inexact): Document
......
2019-10-08 Richard Biener <rguenther@suse.de>
* gcc.dg/vect/pr65947-1.c: Adjust.
* gcc.dg/vect/pr65947-13.c: Likewise.
* gcc.dg/vect/pr65947-14.c: Likewise.
* gcc.dg/vect/pr65947-4.c: Likewise.
* gcc.dg/vect/pr80631-1.c: Likewise.
* gcc.dg/vect/pr80631-2.c: Likewise.
2019-10-08 Tobias Burnus <tobias@codesourcery.com> 2019-10-08 Tobias Burnus <tobias@codesourcery.com>
* gfortran.dg/goacc/continuation-free-form.f95: Update dg-error. * gfortran.dg/goacc/continuation-free-form.f95: Update dg-error.
......
...@@ -42,4 +42,4 @@ main (void) ...@@ -42,4 +42,4 @@ main (void)
/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */ /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */
/* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 4 "vect" { target vect_fold_extract_last } } } */ /* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 4 "vect" { target vect_fold_extract_last } } } */
/* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 4 "vect" { target { ! vect_fold_extract_last } } } } */ /* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 2 "vect" { target { ! vect_fold_extract_last } } } } */
...@@ -41,5 +41,5 @@ main (void) ...@@ -41,5 +41,5 @@ main (void)
} }
/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */ /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */
/* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 4 "vect" { xfail vect_fold_extract_last } } } */ /* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 2 "vect" { xfail vect_fold_extract_last } } } */
/* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 4 "vect" { target vect_fold_extract_last } } } */ /* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 4 "vect" { target vect_fold_extract_last } } } */
...@@ -42,4 +42,4 @@ main (void) ...@@ -42,4 +42,4 @@ main (void)
/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */ /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */
/* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 4 "vect" { target vect_fold_extract_last } } } */ /* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 4 "vect" { target vect_fold_extract_last } } } */
/* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 4 "vect" { target { ! vect_fold_extract_last } } } } */ /* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 2 "vect" { target { ! vect_fold_extract_last } } } } */
...@@ -42,5 +42,5 @@ main (void) ...@@ -42,5 +42,5 @@ main (void)
/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */ /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */
/* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 4 "vect" { target vect_fold_extract_last } } } */ /* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 4 "vect" { target vect_fold_extract_last } } } */
/* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 4 "vect" { target { ! vect_fold_extract_last } } } } */ /* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 2 "vect" { target { ! vect_fold_extract_last } } } } */
...@@ -73,4 +73,4 @@ main () ...@@ -73,4 +73,4 @@ main ()
/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 5 "vect" { target vect_condition } } } */ /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 5 "vect" { target vect_condition } } } */
/* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 10 "vect" { target vect_fold_extract_last } } } */ /* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 10 "vect" { target vect_fold_extract_last } } } */
/* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 10 "vect" { target { { ! vect_fold_extract_last } && vect_condition } } } } */ /* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 5 "vect" { target { { ! vect_fold_extract_last } && vect_condition } } } } */
...@@ -72,5 +72,5 @@ main () ...@@ -72,5 +72,5 @@ main ()
} }
/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 5 "vect" { target vect_condition } } } */ /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 5 "vect" { target vect_condition } } } */
/* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 10 "vect" { target vect_condition xfail vect_fold_extract_last } } } */ /* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 5 "vect" { target vect_condition xfail vect_fold_extract_last } } } */
/* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 10 "vect" { target vect_fold_extract_last } } } */ /* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 10 "vect" { target vect_fold_extract_last } } } */
...@@ -838,9 +838,11 @@ vect_convert_output (stmt_vec_info stmt_info, tree type, gimple *pattern_stmt, ...@@ -838,9 +838,11 @@ vect_convert_output (stmt_vec_info stmt_info, tree type, gimple *pattern_stmt,
static bool static bool
vect_reassociating_reduction_p (stmt_vec_info stmt_vinfo) vect_reassociating_reduction_p (stmt_vec_info stmt_vinfo)
{ {
return (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def if (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def)
? STMT_VINFO_REDUC_TYPE (stmt_vinfo) != FOLD_LEFT_REDUCTION return (STMT_VINFO_REDUC_TYPE (STMT_VINFO_REDUC_DEF (stmt_vinfo))
: REDUC_GROUP_FIRST_ELEMENT (stmt_vinfo) != NULL); != FOLD_LEFT_REDUCTION);
else
return REDUC_GROUP_FIRST_ELEMENT (stmt_vinfo) != NULL;
} }
/* As above, but also require it to have code CODE and to be a reduction /* As above, but also require it to have code CODE and to be a reduction
......
...@@ -3957,17 +3957,6 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance, ...@@ -3957,17 +3957,6 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance,
stmt_vec_info last_stmt_info = vect_find_last_scalar_stmt_in_slp (node); stmt_vec_info last_stmt_info = vect_find_last_scalar_stmt_in_slp (node);
si = gsi_for_stmt (last_stmt_info->stmt); si = gsi_for_stmt (last_stmt_info->stmt);
/* Mark the first element of the reduction chain as reduction to properly
transform the node. In the analysis phase only the last element of the
chain is marked as reduction. */
if (!STMT_VINFO_GROUPED_ACCESS (stmt_info)
&& REDUC_GROUP_FIRST_ELEMENT (stmt_info)
&& REDUC_GROUP_FIRST_ELEMENT (stmt_info) == stmt_info)
{
STMT_VINFO_DEF_TYPE (stmt_info) = vect_reduction_def;
STMT_VINFO_TYPE (stmt_info) = reduc_vec_info_type;
}
/* Handle two-operation SLP nodes by vectorizing the group with /* Handle two-operation SLP nodes by vectorizing the group with
both operations and then performing a merge. */ both operations and then performing a merge. */
if (SLP_TREE_TWO_OPERATORS (node)) if (SLP_TREE_TWO_OPERATORS (node))
......
...@@ -5501,7 +5501,7 @@ vect_supportable_shift (enum tree_code code, tree scalar_type) ...@@ -5501,7 +5501,7 @@ vect_supportable_shift (enum tree_code code, tree scalar_type)
stmt to replace it, put it in VEC_STMT, and insert it at GSI. stmt to replace it, put it in VEC_STMT, and insert it at GSI.
Return true if STMT_INFO is vectorizable in this way. */ Return true if STMT_INFO is vectorizable in this way. */
bool static bool
vectorizable_shift (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, vectorizable_shift (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
stmt_vec_info *vec_stmt, slp_tree slp_node, stmt_vec_info *vec_stmt, slp_tree slp_node,
stmt_vector_for_cost *cost_vec) stmt_vector_for_cost *cost_vec)
...@@ -9776,10 +9776,9 @@ vect_is_simple_cond (tree cond, vec_info *vinfo, ...@@ -9776,10 +9776,9 @@ vect_is_simple_cond (tree cond, vec_info *vinfo,
Return true if STMT_INFO is vectorizable in this way. */ Return true if STMT_INFO is vectorizable in this way. */
bool static bool
vectorizable_condition (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, vectorizable_condition (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
stmt_vec_info *vec_stmt, bool for_reduction, stmt_vec_info *vec_stmt,
int reduc_index,
slp_tree slp_node, stmt_vector_for_cost *cost_vec) slp_tree slp_node, stmt_vector_for_cost *cost_vec)
{ {
vec_info *vinfo = stmt_info->vinfo; vec_info *vinfo = stmt_info->vinfo;
...@@ -9812,17 +9811,36 @@ vectorizable_condition (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -9812,17 +9811,36 @@ vectorizable_condition (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo) if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
return false; return false;
if (for_reduction && STMT_SLP_TYPE (stmt_info)) /* Is vectorizable conditional operation? */
gassign *stmt = dyn_cast <gassign *> (stmt_info->stmt);
if (!stmt)
return false; return false;
vect_reduction_type reduction_type code = gimple_assign_rhs_code (stmt);
= STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info); if (code != COND_EXPR)
if (!for_reduction) return false;
stmt_vec_info reduc_info = NULL;
int reduc_index = -1;
vect_reduction_type reduction_type = TREE_CODE_REDUCTION;
bool for_reduction
= STMT_VINFO_REDUC_DEF (vect_orig_stmt (stmt_info)) != NULL;
if (for_reduction)
{
if (STMT_SLP_TYPE (stmt_info))
return false;
reduc_info = info_for_reduction (stmt_info);
reduction_type = STMT_VINFO_REDUC_TYPE (reduc_info);
reduc_index = STMT_VINFO_REDUC_IDX (stmt_info);
gcc_assert (reduction_type != EXTRACT_LAST_REDUCTION
|| reduc_index != -1);
}
else
{ {
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def) if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
return false; return false;
/* FORNOW: not yet supported. */ /* FORNOW: only supported as part of a reduction. */
if (STMT_VINFO_LIVE_P (stmt_info)) if (STMT_VINFO_LIVE_P (stmt_info))
{ {
if (dump_enabled_p ()) if (dump_enabled_p ())
...@@ -9832,16 +9850,6 @@ vectorizable_condition (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -9832,16 +9850,6 @@ vectorizable_condition (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
} }
} }
/* Is vectorizable conditional operation? */
gassign *stmt = dyn_cast <gassign *> (stmt_info->stmt);
if (!stmt)
return false;
code = gimple_assign_rhs_code (stmt);
if (code != COND_EXPR)
return false;
tree vectype = STMT_VINFO_VECTYPE (stmt_info); tree vectype = STMT_VINFO_VECTYPE (stmt_info);
tree vectype1 = NULL_TREE, vectype2 = NULL_TREE; tree vectype1 = NULL_TREE, vectype2 = NULL_TREE;
...@@ -10665,12 +10673,10 @@ vect_analyze_stmt (stmt_vec_info stmt_info, bool *need_to_vectorize, ...@@ -10665,12 +10673,10 @@ vect_analyze_stmt (stmt_vec_info stmt_info, bool *need_to_vectorize,
|| vectorizable_load (stmt_info, NULL, NULL, node, node_instance, || vectorizable_load (stmt_info, NULL, NULL, node, node_instance,
cost_vec) cost_vec)
|| vectorizable_store (stmt_info, NULL, NULL, node, cost_vec) || vectorizable_store (stmt_info, NULL, NULL, node, cost_vec)
|| vectorizable_reduction (stmt_info, NULL, NULL, node, || vectorizable_reduction (stmt_info, node, node_instance, cost_vec)
node_instance, cost_vec)
|| vectorizable_induction (stmt_info, NULL, NULL, node, cost_vec) || vectorizable_induction (stmt_info, NULL, NULL, node, cost_vec)
|| vectorizable_shift (stmt_info, NULL, NULL, node, cost_vec) || vectorizable_shift (stmt_info, NULL, NULL, node, cost_vec)
|| vectorizable_condition (stmt_info, NULL, NULL, false, -1, node, || vectorizable_condition (stmt_info, NULL, NULL, node, cost_vec)
cost_vec)
|| vectorizable_comparison (stmt_info, NULL, NULL, node, || vectorizable_comparison (stmt_info, NULL, NULL, node,
cost_vec) cost_vec)
|| vectorizable_lc_phi (stmt_info, NULL, node)); || vectorizable_lc_phi (stmt_info, NULL, node));
...@@ -10689,8 +10695,7 @@ vect_analyze_stmt (stmt_vec_info stmt_info, bool *need_to_vectorize, ...@@ -10689,8 +10695,7 @@ vect_analyze_stmt (stmt_vec_info stmt_info, bool *need_to_vectorize,
|| vectorizable_load (stmt_info, NULL, NULL, node, node_instance, || vectorizable_load (stmt_info, NULL, NULL, node, node_instance,
cost_vec) cost_vec)
|| vectorizable_store (stmt_info, NULL, NULL, node, cost_vec) || vectorizable_store (stmt_info, NULL, NULL, node, cost_vec)
|| vectorizable_condition (stmt_info, NULL, NULL, false, -1, node, || vectorizable_condition (stmt_info, NULL, NULL, node, cost_vec)
cost_vec)
|| vectorizable_comparison (stmt_info, NULL, NULL, node, || vectorizable_comparison (stmt_info, NULL, NULL, node,
cost_vec)); cost_vec));
} }
...@@ -10796,8 +10801,7 @@ vect_transform_stmt (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -10796,8 +10801,7 @@ vect_transform_stmt (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
break; break;
case condition_vec_info_type: case condition_vec_info_type:
done = vectorizable_condition (stmt_info, gsi, &vec_stmt, false, -1, done = vectorizable_condition (stmt_info, gsi, &vec_stmt, slp_node, NULL);
slp_node, NULL);
gcc_assert (done); gcc_assert (done);
break; break;
...@@ -10895,20 +10899,22 @@ vect_transform_stmt (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -10895,20 +10899,22 @@ vect_transform_stmt (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
/* If this stmt defines a value used on a backedge, update the /* If this stmt defines a value used on a backedge, update the
vectorized PHIs. */ vectorized PHIs. */
stmt_vec_info orig_stmt_info = vect_orig_stmt (stmt_info); stmt_vec_info orig_stmt_info = vect_orig_stmt (stmt_info);
if (!slp_node && STMT_VINFO_REDUC_DEF (orig_stmt_info) stmt_vec_info reduc_info;
&& STMT_VINFO_REDUC_TYPE (orig_stmt_info) != FOLD_LEFT_REDUCTION if (STMT_VINFO_REDUC_DEF (orig_stmt_info)
&& (STMT_VINFO_REDUC_TYPE (orig_stmt_info) != COND_REDUCTION && (reduc_info = info_for_reduction (orig_stmt_info))
|| (STMT_VINFO_VEC_REDUCTION_TYPE (orig_stmt_info) && STMT_VINFO_REDUC_TYPE (reduc_info) != FOLD_LEFT_REDUCTION
!= EXTRACT_LAST_REDUCTION)) && STMT_VINFO_REDUC_TYPE (reduc_info) != EXTRACT_LAST_REDUCTION)
&& is_a <gphi *> (STMT_VINFO_REDUC_DEF (orig_stmt_info)->stmt)) {
{ gphi *phi;
gphi *phi = as_a <gphi *> (STMT_VINFO_REDUC_DEF (orig_stmt_info)->stmt); if (!slp_node
if (dominated_by_p (CDI_DOMINATORS, && (phi = dyn_cast <gphi *>
gimple_bb (orig_stmt_info->stmt), gimple_bb (phi))) (STMT_VINFO_REDUC_DEF (orig_stmt_info)->stmt))
&& dominated_by_p (CDI_DOMINATORS,
gimple_bb (orig_stmt_info->stmt), gimple_bb (phi)))
{ {
edge e = loop_latch_edge (gimple_bb (phi)->loop_father); edge e = loop_latch_edge (gimple_bb (phi)->loop_father);
stmt_vec_info phi_info stmt_vec_info phi_info
= STMT_VINFO_VEC_STMT (STMT_VINFO_REDUC_DEF (orig_stmt_info)); = STMT_VINFO_VEC_STMT (STMT_VINFO_REDUC_DEF (orig_stmt_info));
stmt_vec_info vec_stmt = STMT_VINFO_VEC_STMT (stmt_info); stmt_vec_info vec_stmt = STMT_VINFO_VEC_STMT (stmt_info);
do do
{ {
...@@ -10921,24 +10927,19 @@ vect_transform_stmt (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -10921,24 +10927,19 @@ vect_transform_stmt (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
while (phi_info); while (phi_info);
gcc_assert (!vec_stmt); gcc_assert (!vec_stmt);
} }
} else if (slp_node
else if (slp_node && STMT_VINFO_REDUC_DEF (orig_stmt_info) && slp_node != slp_node_instance->reduc_phis)
/* Going back and forth via STMT_VINFO_REDUC_DEF gets us to the {
stmt with the reduction meta in case of reduction groups. */ slp_tree phi_node = slp_node_instance->reduc_phis;
&& (STMT_VINFO_REDUC_TYPE gphi *phi = as_a <gphi *> (SLP_TREE_SCALAR_STMTS (phi_node)[0]->stmt);
(STMT_VINFO_REDUC_DEF (STMT_VINFO_REDUC_DEF (orig_stmt_info))) edge e = loop_latch_edge (gimple_bb (phi)->loop_father);
!= FOLD_LEFT_REDUCTION) gcc_assert (SLP_TREE_VEC_STMTS (phi_node).length ()
&& slp_node != slp_node_instance->reduc_phis) == SLP_TREE_VEC_STMTS (slp_node).length ());
{ for (unsigned i = 0; i < SLP_TREE_VEC_STMTS (phi_node).length (); ++i)
slp_tree phi_node = slp_node_instance->reduc_phis; add_phi_arg (as_a <gphi *> (SLP_TREE_VEC_STMTS (phi_node)[i]->stmt),
gphi *phi = as_a <gphi *> (SLP_TREE_SCALAR_STMTS (phi_node)[0]->stmt); gimple_get_lhs (SLP_TREE_VEC_STMTS (slp_node)[i]->stmt),
edge e = loop_latch_edge (gimple_bb (phi)->loop_father); e, gimple_phi_arg_location (phi, e->dest_idx));
gcc_assert (SLP_TREE_VEC_STMTS (phi_node).length () }
== SLP_TREE_VEC_STMTS (slp_node).length ());
for (unsigned i = 0; i < SLP_TREE_VEC_STMTS (phi_node).length (); ++i)
add_phi_arg (as_a <gphi *> (SLP_TREE_VEC_STMTS (phi_node)[i]->stmt),
gimple_get_lhs (SLP_TREE_VEC_STMTS (slp_node)[i]->stmt),
e, gimple_phi_arg_location (phi, e->dest_idx));
} }
/* Handle stmts whose DEF is used outside the loop-nest that is /* Handle stmts whose DEF is used outside the loop-nest that is
......
...@@ -637,7 +637,7 @@ vec_info::new_stmt_vec_info (gimple *stmt) ...@@ -637,7 +637,7 @@ vec_info::new_stmt_vec_info (gimple *stmt)
STMT_VINFO_TYPE (res) = undef_vec_info_type; STMT_VINFO_TYPE (res) = undef_vec_info_type;
STMT_VINFO_RELEVANT (res) = vect_unused_in_scope; STMT_VINFO_RELEVANT (res) = vect_unused_in_scope;
STMT_VINFO_VECTORIZABLE (res) = true; STMT_VINFO_VECTORIZABLE (res) = true;
STMT_VINFO_VEC_REDUCTION_TYPE (res) = TREE_CODE_REDUCTION; STMT_VINFO_REDUC_TYPE (res) = TREE_CODE_REDUCTION;
STMT_VINFO_VEC_COND_REDUC_CODE (res) = ERROR_MARK; STMT_VINFO_VEC_COND_REDUC_CODE (res) = ERROR_MARK;
STMT_VINFO_REDUC_CODE (res) = ERROR_MARK; STMT_VINFO_REDUC_CODE (res) = ERROR_MARK;
STMT_VINFO_REDUC_FN (res) = IFN_LAST; STMT_VINFO_REDUC_FN (res) = IFN_LAST;
......
...@@ -933,9 +933,6 @@ public: ...@@ -933,9 +933,6 @@ public:
for loop vectorization. */ for loop vectorization. */
vect_memory_access_type memory_access_type; vect_memory_access_type memory_access_type;
/* For reduction loops, this is the type of reduction. */
enum vect_reduction_type v_reduc_type;
/* For CONST_COND_REDUCTION and INTEGER_INDUC_COND_REDUCTION, the /* For CONST_COND_REDUCTION and INTEGER_INDUC_COND_REDUCTION, the
reduction code. */ reduction code. */
enum tree_code cond_reduc_code; enum tree_code cond_reduc_code;
...@@ -947,7 +944,7 @@ public: ...@@ -947,7 +944,7 @@ public:
tree reduc_epilogue_adjustment; tree reduc_epilogue_adjustment;
/* On a reduction PHI the reduction type as detected by /* On a reduction PHI the reduction type as detected by
vect_force_simple_reduction. */ vect_is_simple_reduction and vectorizable_reduction. */
enum vect_reduction_type reduc_type; enum vect_reduction_type reduc_type;
/* The original reduction code, to be used in the epilogue. */ /* The original reduction code, to be used in the epilogue. */
...@@ -964,6 +961,9 @@ public: ...@@ -964,6 +961,9 @@ public:
corresponding PHI. */ corresponding PHI. */
stmt_vec_info reduc_def; stmt_vec_info reduc_def;
/* Whether on this stmt reduction meta is recorded. */
bool is_reduc_info;
/* The number of scalar stmt references from active SLP instances. */ /* The number of scalar stmt references from active SLP instances. */
unsigned int num_slp_uses; unsigned int num_slp_uses;
...@@ -1046,7 +1046,6 @@ STMT_VINFO_BB_VINFO (stmt_vec_info stmt_vinfo) ...@@ -1046,7 +1046,6 @@ STMT_VINFO_BB_VINFO (stmt_vec_info stmt_vinfo)
#define STMT_VINFO_STRIDED_P(S) (S)->strided_p #define STMT_VINFO_STRIDED_P(S) (S)->strided_p
#define STMT_VINFO_MEMORY_ACCESS_TYPE(S) (S)->memory_access_type #define STMT_VINFO_MEMORY_ACCESS_TYPE(S) (S)->memory_access_type
#define STMT_VINFO_SIMD_LANE_ACCESS_P(S) (S)->simd_lane_access_p #define STMT_VINFO_SIMD_LANE_ACCESS_P(S) (S)->simd_lane_access_p
#define STMT_VINFO_VEC_REDUCTION_TYPE(S) (S)->v_reduc_type
#define STMT_VINFO_VEC_COND_REDUC_CODE(S) (S)->cond_reduc_code #define STMT_VINFO_VEC_COND_REDUC_CODE(S) (S)->cond_reduc_code
#define STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL(S) (S)->induc_cond_initial_val #define STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL(S) (S)->induc_cond_initial_val
#define STMT_VINFO_REDUC_EPILOGUE_ADJUSTMENT(S) (S)->reduc_epilogue_adjustment #define STMT_VINFO_REDUC_EPILOGUE_ADJUSTMENT(S) (S)->reduc_epilogue_adjustment
...@@ -1556,12 +1555,6 @@ extern bool vect_transform_stmt (stmt_vec_info, gimple_stmt_iterator *, ...@@ -1556,12 +1555,6 @@ extern bool vect_transform_stmt (stmt_vec_info, gimple_stmt_iterator *,
extern void vect_remove_stores (stmt_vec_info); extern void vect_remove_stores (stmt_vec_info);
extern opt_result vect_analyze_stmt (stmt_vec_info, bool *, slp_tree, extern opt_result vect_analyze_stmt (stmt_vec_info, bool *, slp_tree,
slp_instance, stmt_vector_for_cost *); slp_instance, stmt_vector_for_cost *);
extern bool vectorizable_condition (stmt_vec_info, gimple_stmt_iterator *,
stmt_vec_info *, bool, int, slp_tree,
stmt_vector_for_cost *);
extern bool vectorizable_shift (stmt_vec_info, gimple_stmt_iterator *,
stmt_vec_info *, slp_tree,
stmt_vector_for_cost *);
extern void vect_get_load_cost (stmt_vec_info, int, bool, extern void vect_get_load_cost (stmt_vec_info, int, bool,
unsigned int *, unsigned int *, unsigned int *, unsigned int *,
stmt_vector_for_cost *, stmt_vector_for_cost *,
...@@ -1644,6 +1637,7 @@ extern void vect_record_loop_mask (loop_vec_info, vec_loop_masks *, ...@@ -1644,6 +1637,7 @@ extern void vect_record_loop_mask (loop_vec_info, vec_loop_masks *,
unsigned int, tree); unsigned int, tree);
extern tree vect_get_loop_mask (gimple_stmt_iterator *, vec_loop_masks *, extern tree vect_get_loop_mask (gimple_stmt_iterator *, vec_loop_masks *,
unsigned int, tree, unsigned int); unsigned int, tree, unsigned int);
extern stmt_vec_info info_for_reduction (stmt_vec_info);
/* Drive for loop transformation stage. */ /* Drive for loop transformation stage. */
extern class loop *vect_transform_loop (loop_vec_info); extern class loop *vect_transform_loop (loop_vec_info);
...@@ -1653,8 +1647,7 @@ extern bool vectorizable_live_operation (stmt_vec_info, gimple_stmt_iterator *, ...@@ -1653,8 +1647,7 @@ extern bool vectorizable_live_operation (stmt_vec_info, gimple_stmt_iterator *,
slp_tree, slp_instance, int, slp_tree, slp_instance, int,
stmt_vec_info *, stmt_vec_info *,
stmt_vector_for_cost *); stmt_vector_for_cost *);
extern bool vectorizable_reduction (stmt_vec_info, gimple_stmt_iterator *, extern bool vectorizable_reduction (stmt_vec_info, slp_tree, slp_instance,
stmt_vec_info *, slp_tree, slp_instance,
stmt_vector_for_cost *); stmt_vector_for_cost *);
extern bool vectorizable_induction (stmt_vec_info, gimple_stmt_iterator *, extern bool vectorizable_induction (stmt_vec_info, gimple_stmt_iterator *,
stmt_vec_info *, slp_tree, stmt_vec_info *, slp_tree,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment