aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2013-05-29 08:44:23 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2013-05-29 08:44:23 +0000
commit292cba13912dae6eba49d4063e14d089e8705465 (patch)
tree6f27c740d3aeef4b16f93bcf7697c9dc722abeba
parent6eddf228932b9a7146aac7c930c0ed1eefe2be9f (diff)
downloadgcc-292cba13912dae6eba49d4063e14d089e8705465.zip
gcc-292cba13912dae6eba49d4063e14d089e8705465.tar.gz
gcc-292cba13912dae6eba49d4063e14d089e8705465.tar.bz2
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.
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. From-SVN: r199403
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/tree-vect-slp.c10
2 files changed, 14 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 456a4cf..012c7c4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
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.
+
+2013-05-29 Richard Biener <rguenther@suse.de>
+
* tree-vect-slp.c (vect_bb_slp_scalar_cost): New function
computing scalar cost offsetted by stmts that are kept live
by scalar uses.
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 5d8e85f..3dde063 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1904,7 +1904,8 @@ vect_slp_analyze_operations (bb_vec_info bb_vinfo)
update LIFE according to uses of NODE. */
static unsigned
-vect_bb_slp_scalar_cost (slp_tree node, vec<bool, va_stack> life)
+vect_bb_slp_scalar_cost (basic_block bb,
+ slp_tree node, vec<bool, va_stack> life)
{
unsigned scalar_cost = 0;
unsigned i;
@@ -1931,7 +1932,7 @@ vect_bb_slp_scalar_cost (slp_tree node, vec<bool, va_stack> life)
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)
+ if (gimple_bb (use_stmt) != bb
|| !STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (use_stmt)))
{
life[i] = true;
@@ -1956,7 +1957,7 @@ vect_bb_slp_scalar_cost (slp_tree node, vec<bool, va_stack> life)
}
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
- scalar_cost += vect_bb_slp_scalar_cost (child, life);
+ scalar_cost += vect_bb_slp_scalar_cost (bb, child, life);
return scalar_cost;
}
@@ -1995,7 +1996,8 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo)
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),
+ scalar_cost += vect_bb_slp_scalar_cost (BB_VINFO_BB (bb_vinfo),
+ SLP_INSTANCE_TREE (instance),
life);
life.release ();
}