aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-slp.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-02-08 07:40:31 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-02-08 07:40:31 +0000
commitdabc2afc703eb40509fc4d399cfaa095b34917a2 (patch)
tree8e51169dabc440340cf858a0cace36a8cbf86126 /gcc/tree-vect-slp.c
parente2c3509a5e65d50cc733440149e22e40fc87a945 (diff)
downloadgcc-dabc2afc703eb40509fc4d399cfaa095b34917a2.zip
gcc-dabc2afc703eb40509fc4d399cfaa095b34917a2.tar.gz
gcc-dabc2afc703eb40509fc4d399cfaa095b34917a2.tar.bz2
backport: [multiple changes]
2019-02-08 Richard Biener <rguenther@suse.de> Backport from mainline 2018-12-10 Richard Biener <rguenther@suse.de> PR tree-optimization/88427 * vr-values.c (vr_values::extract_range_from_phi_node): Handle symbolic ranges conservatively when trying to drop to Inf +- 1. * gcc.dg/pr88427.c: New testcase. 2018-11-28 Richard Biener <rguenther@suse.de> PR tree-optimization/88217 * vr-values.c (vr_values::extract_range_from_phi_node): Make sure to handle results > +INF and < -INF correctly when trying to drop down to +INF - 1 or -INF + 1. * g++.dg/pr88217.C: New testcase. 2018-11-23 Richard Biener <rguenther@suse.de> PR tree-optimization/88149 * tree-vect-slp.c (vect_slp_analyze_node_operations): Detect the case where there are two different def types for the same operand at different operand position in the same stmt. * g++.dg/torture/pr88149.C: New testcase. From-SVN: r268665
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r--gcc/tree-vect-slp.c41
1 files changed, 34 insertions, 7 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 48ed96b..625e99a 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -2819,21 +2819,48 @@ vect_slp_analyze_node_operations (vec_info *vinfo, slp_tree node,
= vect_get_num_vectors (vf * group_size, vectype);
}
+ /* ??? We have to catch the case late where two first scalar stmts appear
+ in multiple SLP children with different def type and fail. Remember
+ original def types first since SLP_TREE_DEF_TYPE doesn't necessarily
+ match it when that is vect_internal_def. */
+ auto_vec<vect_def_type, 4> dt;
+ dt.safe_grow (SLP_TREE_CHILDREN (node).length ());
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child)
+ dt[j]
+ = STMT_VINFO_DEF_TYPE (vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (child)[0]));
+
/* Push SLP node def-type to stmt operands. */
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child)
if (SLP_TREE_DEF_TYPE (child) != vect_internal_def)
STMT_VINFO_DEF_TYPE (vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (child)[0]))
= SLP_TREE_DEF_TYPE (child);
- bool res = vect_analyze_stmt (stmt, &dummy, node, node_instance);
+
+ /* Check everything worked out. */
+ bool res = true;
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child)
+ if (SLP_TREE_DEF_TYPE (child) != vect_internal_def)
+ {
+ if (STMT_VINFO_DEF_TYPE
+ (vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (child)[0]))
+ != SLP_TREE_DEF_TYPE (child))
+ res = false;
+ }
+ else if (STMT_VINFO_DEF_TYPE
+ (vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (child)[0])) != dt[j])
+ res = false;
+ if (!res && dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: same operand with different "
+ "def type in stmt.\n");
+ if (res)
+ res = vect_analyze_stmt (stmt, &dummy, node, node_instance);
+
/* Restore def-types. */
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child)
- if (SLP_TREE_DEF_TYPE (child) != vect_internal_def)
- STMT_VINFO_DEF_TYPE (vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (child)[0]))
- = vect_internal_def;
- if (! res)
- return false;
+ STMT_VINFO_DEF_TYPE (vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (child)[0]))
+ = dt[j];
- return true;
+ return res;
}