Commit e44978dc by Richard Biener Committed by Richard Biener

re PR tree-optimization/56157 (ICE with -ftree-vectorize in in compute_live_loop_exits)

2013-01-31  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/56157
	* tree-vect-slp.c (vect_get_slp_defs): More thoroughly try to
	match up operand with SLP child.

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

From-SVN: r195616
parent 422e2fc0
2013-01-31 Richard Biener <rguenther@suse.de>
PR tree-optimization/56157
* tree-vect-slp.c (vect_get_slp_defs): More thoroughly try to
match up operand with SLP child.
2013-01-31 Jason Merrill <jason@redhat.com> 2013-01-31 Jason Merrill <jason@redhat.com>
PR c++/54410 PR c++/54410
......
2013-01-31 Richard Biener <rguenther@suse.de>
PR tree-optimization/56157
* gcc.dg/torture/pr56157.c: New testcase.
2013-01-30 Richard Biener <rguenther@suse.de> 2013-01-30 Richard Biener <rguenther@suse.de>
PR tree-optimization/56150 PR tree-optimization/56150
......
/* { dg-do compile } */
/* { dg-options "-ftree-vectorize" } */
struct Pixel {
unsigned short r;
unsigned short g;
unsigned short b;
unsigned short a;
};
void fn(unsigned char * __restrict dst, const unsigned char * __restrict src)
{
unsigned x;
for(x = 0; x < 1024; x += 1)
{
struct Pixel pixel;
pixel.r = (unsigned short)(((unsigned)src[0]) * 0xffff / 0xff);
pixel.g = (unsigned short)(((unsigned)src[1]) * 0xffff / 0xff);
pixel.b = (unsigned short)(((unsigned)src[2]) * 0xffff / 0xff);
pixel.a = (unsigned short)(((unsigned)src[3]) * 0xffff / 0xff);
__builtin_memcpy(dst, &pixel, sizeof pixel);
src += 4;
dst += 8;
}
}
...@@ -2616,13 +2616,13 @@ void ...@@ -2616,13 +2616,13 @@ void
vect_get_slp_defs (vec<tree> ops, slp_tree slp_node, vect_get_slp_defs (vec<tree> ops, slp_tree slp_node,
vec<slp_void_p> *vec_oprnds, int reduc_index) vec<slp_void_p> *vec_oprnds, int reduc_index)
{ {
gimple first_stmt, first_def; gimple first_stmt;
int number_of_vects = 0, i; int number_of_vects = 0, i;
unsigned int child_index = 0; unsigned int child_index = 0;
HOST_WIDE_INT lhs_size_unit, rhs_size_unit; HOST_WIDE_INT lhs_size_unit, rhs_size_unit;
slp_tree child = NULL; slp_tree child = NULL;
vec<tree> *vec_defs; vec<tree> *vec_defs;
tree oprnd, def_lhs; tree oprnd;
bool vectorized_defs; bool vectorized_defs;
first_stmt = SLP_TREE_SCALAR_STMTS (slp_node)[0]; first_stmt = SLP_TREE_SCALAR_STMTS (slp_node)[0];
...@@ -2638,29 +2638,22 @@ vect_get_slp_defs (vec<tree> ops, slp_tree slp_node, ...@@ -2638,29 +2638,22 @@ vect_get_slp_defs (vec<tree> ops, slp_tree slp_node,
if (SLP_TREE_CHILDREN (slp_node).length () > child_index) if (SLP_TREE_CHILDREN (slp_node).length () > child_index)
{ {
child = (slp_tree) SLP_TREE_CHILDREN (slp_node)[child_index]; child = (slp_tree) SLP_TREE_CHILDREN (slp_node)[child_index];
first_def = SLP_TREE_SCALAR_STMTS (child)[0];
/* In the end of a pattern sequence we have a use of the original stmt,
so we need to compare OPRND with the original def. */
if (is_pattern_stmt_p (vinfo_for_stmt (first_def))
&& !STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (first_stmt))
&& !is_pattern_stmt_p (vinfo_for_stmt (first_stmt)))
first_def = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (first_def));
if (is_gimple_call (first_def)) /* We have to check both pattern and original def, if available. */
def_lhs = gimple_call_lhs (first_def); gimple first_def = SLP_TREE_SCALAR_STMTS (child)[0];
else gimple related = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (first_def));
def_lhs = gimple_assign_lhs (first_def);
if (operand_equal_p (oprnd, def_lhs, 0)) if (operand_equal_p (oprnd, gimple_get_lhs (first_def), 0)
{ || (related
/* The number of vector defs is determined by the number of && operand_equal_p (oprnd, gimple_get_lhs (related), 0)))
vector statements in the node from which we get those {
/* The number of vector defs is determined by the number of
vector statements in the node from which we get those
statements. */ statements. */
number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (child); number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (child);
vectorized_defs = true; vectorized_defs = true;
child_index++; child_index++;
} }
} }
if (!vectorized_defs) if (!vectorized_defs)
......
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