diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-02 07:50:19 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-02 07:50:19 +0000 |
commit | 7a6adcfdf693f5349639ecc1583fd5cd15ac2174 (patch) | |
tree | 9e29084b4af4a84e35f755a0790bf17700693d03 /gcc/tree-vect-slp.c | |
parent | d0c221ca42fbaf2456810a5574284f2d3d7e416e (diff) | |
download | gcc-7a6adcfdf693f5349639ecc1583fd5cd15ac2174.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224013 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r-- | gcc/tree-vect-slp.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index fb57dd41111..9e36d9cccab 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; |