Commit 7098ab48 by Richard Biener Committed by Richard Biener

re PR tree-optimization/92222 (ice in useless_type_conversion_p, at gimple-expr.c:86)

2019-10-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/92222
	* tree-vect-slp.c (_slp_oprnd_info::first_pattern): Remove.
	(_slp_oprnd_info::second_pattern): Likewise.
	(_slp_oprnd_info::any_pattern): New.
	(vect_create_oprnd_info): Adjust.
	(vect_get_and_check_slp_defs): Compute whether any stmt is
	in a pattern.
	(vect_build_slp_tree_2): Avoid building up a node from scalars
	if any of the operand defs, not just the first, is in a pattern.

	* gcc.dg/torture/pr92222.c: New testcase.

From-SVN: r277448
parent 77100812
2019-10-25 Richard Biener <rguenther@suse.de> 2019-10-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/92222
* tree-vect-slp.c (_slp_oprnd_info::first_pattern): Remove.
(_slp_oprnd_info::second_pattern): Likewise.
(_slp_oprnd_info::any_pattern): New.
(vect_create_oprnd_info): Adjust.
(vect_get_and_check_slp_defs): Compute whether any stmt is
in a pattern.
(vect_build_slp_tree_2): Avoid building up a node from scalars
if any of the operand defs, not just the first, is in a pattern.
2019-10-25 Richard Biener <rguenther@suse.de>
* tree-vect-slp.c (vect_get_and_check_slp_defs): Only fail * tree-vect-slp.c (vect_get_and_check_slp_defs): Only fail
swapping if we actually have to modify the IL on a shared stmt. swapping if we actually have to modify the IL on a shared stmt.
(vect_build_slp_tree_2): Never fail swapping on shared stmts (vect_build_slp_tree_2): Never fail swapping on shared stmts
2019-10-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/92222
* gcc.dg/torture/pr92222.c: New testcase.
2019-10-25 Richard Sandiford <richard.sandiford@arm.com> 2019-10-25 Richard Sandiford <richard.sandiford@arm.com>
* gcc.target/aarch64/sve/reduc_strict_3.c (double_reduc1): Prevent * gcc.target/aarch64/sve/reduc_strict_3.c (double_reduc1): Prevent
......
/* { dg-do compile } */
/* { dg-additional-options "-ftree-vectorize" } */
unsigned char *a;
int b;
void f();
void c()
{
char *d;
int e;
for (; b; b++) {
e = 7;
for (; e >= 0; e--)
*d++ = a[b] & 1 << e ? '1' : '0';
}
f();
}
...@@ -177,8 +177,7 @@ typedef struct _slp_oprnd_info ...@@ -177,8 +177,7 @@ typedef struct _slp_oprnd_info
stmt. */ stmt. */
tree first_op_type; tree first_op_type;
enum vect_def_type first_dt; enum vect_def_type first_dt;
bool first_pattern; bool any_pattern;
bool second_pattern;
} *slp_oprnd_info; } *slp_oprnd_info;
...@@ -199,8 +198,7 @@ vect_create_oprnd_info (int nops, int group_size) ...@@ -199,8 +198,7 @@ vect_create_oprnd_info (int nops, int group_size)
oprnd_info->ops.create (group_size); oprnd_info->ops.create (group_size);
oprnd_info->first_dt = vect_uninitialized_def; oprnd_info->first_dt = vect_uninitialized_def;
oprnd_info->first_op_type = NULL_TREE; oprnd_info->first_op_type = NULL_TREE;
oprnd_info->first_pattern = false; oprnd_info->any_pattern = false;
oprnd_info->second_pattern = false;
oprnds_info.quick_push (oprnd_info); oprnds_info.quick_push (oprnd_info);
} }
...@@ -339,13 +337,11 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char *swap, ...@@ -339,13 +337,11 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char *swap,
tree oprnd; tree oprnd;
unsigned int i, number_of_oprnds; unsigned int i, number_of_oprnds;
enum vect_def_type dt = vect_uninitialized_def; enum vect_def_type dt = vect_uninitialized_def;
bool pattern = false;
slp_oprnd_info oprnd_info; slp_oprnd_info oprnd_info;
int first_op_idx = 1; int first_op_idx = 1;
unsigned int commutative_op = -1U; unsigned int commutative_op = -1U;
bool first_op_cond = false; bool first_op_cond = false;
bool first = stmt_num == 0; bool first = stmt_num == 0;
bool second = stmt_num == 1;
if (gcall *stmt = dyn_cast <gcall *> (stmt_info->stmt)) if (gcall *stmt = dyn_cast <gcall *> (stmt_info->stmt))
{ {
...@@ -418,13 +414,12 @@ again: ...@@ -418,13 +414,12 @@ again:
return -1; return -1;
} }
if (second) if (def_stmt_info && is_pattern_stmt_p (def_stmt_info))
oprnd_info->second_pattern = pattern; oprnd_info->any_pattern = true;
if (first) if (first)
{ {
oprnd_info->first_dt = dt; oprnd_info->first_dt = dt;
oprnd_info->first_pattern = pattern;
oprnd_info->first_op_type = TREE_TYPE (oprnd); oprnd_info->first_op_type = TREE_TYPE (oprnd);
} }
else else
...@@ -1311,7 +1306,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, ...@@ -1311,7 +1306,7 @@ vect_build_slp_tree_2 (vec_info *vinfo,
/* ??? Rejecting patterns this way doesn't work. We'd have to /* ??? Rejecting patterns this way doesn't work. We'd have to
do extra work to cancel the pattern so the uses see the do extra work to cancel the pattern so the uses see the
scalar version. */ scalar version. */
&& !is_pattern_stmt_p (SLP_TREE_SCALAR_STMTS (child)[0])) && !oprnd_info->any_pattern)
{ {
slp_tree grandchild; slp_tree grandchild;
...@@ -1358,7 +1353,8 @@ vect_build_slp_tree_2 (vec_info *vinfo, ...@@ -1358,7 +1353,8 @@ vect_build_slp_tree_2 (vec_info *vinfo,
/* ??? Rejecting patterns this way doesn't work. We'd have to /* ??? Rejecting patterns this way doesn't work. We'd have to
do extra work to cancel the pattern so the uses see the do extra work to cancel the pattern so the uses see the
scalar version. */ scalar version. */
&& !is_pattern_stmt_p (stmt_info)) && !is_pattern_stmt_p (stmt_info)
&& !oprnd_info->any_pattern)
{ {
if (dump_enabled_p ()) if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location, dump_printf_loc (MSG_NOTE, vect_location,
...@@ -1447,7 +1443,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, ...@@ -1447,7 +1443,7 @@ vect_build_slp_tree_2 (vec_info *vinfo,
/* ??? Rejecting patterns this way doesn't work. We'd have /* ??? Rejecting patterns this way doesn't work. We'd have
to do extra work to cancel the pattern so the uses see the to do extra work to cancel the pattern so the uses see the
scalar version. */ scalar version. */
&& !is_pattern_stmt_p (SLP_TREE_SCALAR_STMTS (child)[0])) && !oprnd_info->any_pattern)
{ {
unsigned int j; unsigned int j;
slp_tree grandchild; slp_tree grandchild;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment