aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-slp.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-06-02 07:50:19 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-06-02 07:50:19 +0000
commit3fc356dcdc68bf3e44d8b08a0579b057021c95f4 (patch)
tree9e29084b4af4a84e35f755a0790bf17700693d03 /gcc/tree-vect-slp.c
parent4c50b2212d92f84945a39df321f0eb10dedf98c7 (diff)
downloadgcc-3fc356dcdc68bf3e44d8b08a0579b057021c95f4.zip
gcc-3fc356dcdc68bf3e44d8b08a0579b057021c95f4.tar.gz
gcc-3fc356dcdc68bf3e44d8b08a0579b057021c95f4.tar.bz2
re PR tree-optimization/65961 (ice in vect_is_simple_use_1 with -O3)
2015-06-02 Richard Biener <rguenther@suse.de> PR tree-optimization/65961 * tree-vect-slp.c (vect_get_and_check_slp_defs): Remove bogus check and clarify dump message. (vect_build_slp_tree): If all children are built up from scalars build up the parent from scalars instead. * tree-vect-stmts.c (vect_is_simple_use): Cleanup. * gcc.dg/torture/pr65961.c: New testcase. From-SVN: r224013
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r--gcc/tree-vect-slp.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index fb57dd4..9e36d9c 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -301,13 +301,12 @@ again:
oprnd_info = (*oprnds_info)[i];
if (!vect_is_simple_use (oprnd, NULL, loop_vinfo, bb_vinfo, &def_stmt,
- &def, &dt)
- || (!def_stmt && dt != vect_constant_def))
+ &def, &dt))
{
if (dump_enabled_p ())
{
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Build SLP failed: can't find def for ");
+ "Build SLP failed: can't analyze def for ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, oprnd);
dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
@@ -1092,6 +1091,35 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
vectorization_factor, matches,
npermutes, &this_tree_size, max_tree_size))
{
+ /* If we have all children of child built up from scalars then just
+ throw that away and build it up this node from scalars. */
+ if (!SLP_TREE_CHILDREN (child).is_empty ())
+ {
+ unsigned int j;
+ slp_tree grandchild;
+
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (child), j, grandchild)
+ if (grandchild != NULL)
+ break;
+ if (!grandchild)
+ {
+ /* Roll back. */
+ *max_nunits = old_max_nunits;
+ loads->truncate (old_nloads);
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (child), j, grandchild)
+ vect_free_slp_tree (grandchild);
+ SLP_TREE_CHILDREN (child).truncate (0);
+
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "Building parent vector operands from "
+ "scalars instead\n");
+ oprnd_info->def_stmts = vNULL;
+ vect_free_slp_tree (child);
+ SLP_TREE_CHILDREN (*node).quick_push (NULL);
+ continue;
+ }
+ }
+
oprnd_info->def_stmts = vNULL;
SLP_TREE_CHILDREN (*node).quick_push (child);
continue;