This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix vect_bb_slp_scalar_cost change
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 29 May 2013 11:03:07 +0200 (CEST)
- Subject: [PATCH] Fix vect_bb_slp_scalar_cost change
My commit crossed the Cilk+ changes and only its testcases expose
that we do not set stmt UIDs on blocks we currently vectorize and
thus other vinfo_for_stmt calls have to be properly guarded.
Tested on x86_64-unknown-linux-gnu, applied as obvious.
Richard.
2013-05-29 Richard Biener <rguenther@suse.de>
* tree-vect-slp.c (vect_bb_slp_scalar_cost): Guard vinfo
access on whether the use is in the BB we currently try to
vectorize.
(vect_bb_vectorization_profitable_p): Pass the BB we currently
vectorize to vect_bb_slp_scalar_cost.
Index: gcc/tree-vect-slp.c
===================================================================
*** gcc/tree-vect-slp.c (revision 199402)
--- gcc/tree-vect-slp.c (working copy)
*************** vect_slp_analyze_operations (bb_vec_info
*** 1904,1910 ****
update LIFE according to uses of NODE. */
static unsigned
! vect_bb_slp_scalar_cost (slp_tree node, vec<bool, va_stack> life)
{
unsigned scalar_cost = 0;
unsigned i;
--- 1904,1911 ----
update LIFE according to uses of NODE. */
static unsigned
! vect_bb_slp_scalar_cost (basic_block bb,
! slp_tree node, vec<bool, va_stack> life)
{
unsigned scalar_cost = 0;
unsigned i;
*************** vect_bb_slp_scalar_cost (slp_tree node,
*** 1931,1937 ****
imm_use_iterator use_iter;
gimple use_stmt;
FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, DEF_FROM_PTR (def_p))
! if (!vinfo_for_stmt (use_stmt)
|| !STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (use_stmt)))
{
life[i] = true;
--- 1932,1938 ----
imm_use_iterator use_iter;
gimple use_stmt;
FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, DEF_FROM_PTR (def_p))
! if (gimple_bb (use_stmt) != bb
|| !STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (use_stmt)))
{
life[i] = true;
*************** vect_bb_slp_scalar_cost (slp_tree node,
*** 1956,1962 ****
}
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
! scalar_cost += vect_bb_slp_scalar_cost (child, life);
return scalar_cost;
}
--- 1957,1963 ----
}
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
! scalar_cost += vect_bb_slp_scalar_cost (bb, child, life);
return scalar_cost;
}
*************** vect_bb_vectorization_profitable_p (bb_v
*** 1995,2001 ****
vec<bool, va_stack> life;
vec_stack_alloc (bool, life, SLP_INSTANCE_GROUP_SIZE (instance));
life.quick_grow_cleared (SLP_INSTANCE_GROUP_SIZE (instance));
! scalar_cost += vect_bb_slp_scalar_cost (SLP_INSTANCE_TREE (instance),
life);
life.release ();
}
--- 1996,2003 ----
vec<bool, va_stack> life;
vec_stack_alloc (bool, life, SLP_INSTANCE_GROUP_SIZE (instance));
life.quick_grow_cleared (SLP_INSTANCE_GROUP_SIZE (instance));
! scalar_cost += vect_bb_slp_scalar_cost (BB_VINFO_BB (bb_vinfo),
! SLP_INSTANCE_TREE (instance),
life);
life.release ();
}