Commit 603cca93 by Richard Biener Committed by Richard Biener

re PR middle-end/68852 (ICE in vect_is_simple_use (tree-vect-stmts.c:8750) using -O3)

2015-12-14  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/68852
	* tree-vectorizer.h (struct _slp_tree): Add def_type member.
	(SLP_TREE_DEF_TYPE): New accessor.
	* tree-vect-stmts.c (vect_is_simple_use): Remove BB vectorization
	hack.
	* tree-vect-slp.c (vect_create_new_slp_node): Initialize
	SLP_TREE_DEF_TYPE.
	(vect_build_slp_tree): When a node is to be built up from scalars
	do not push a NULL as child but instead set its def_type to
	vect_external_def.
	(vect_analyze_slp_cost_1): Check for child def-type instead
	of NULL.
	(vect_detect_hybrid_slp_stmts): Likewise.
	(vect_bb_slp_scalar_cost): Likewise.
	(vect_get_slp_defs): Likewise.
	(vect_slp_analyze_node_operations): Likewise.  Before
	processing node push the children def-types to the underlying
	stmts vinfo and restore it afterwards.
	(vect_schedule_slp_instance): Likewise.
	(vect_slp_analyze_bb_1): Do not mark stmts not in SLP instances
	as not vectorizable.

	* g++.dg/torture/pr68852.C: New testcase.

From-SVN: r231619
parent 60f2b864
2015-12-14 Richard Biener <rguenther@suse.de> 2015-12-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/68852
* tree-vectorizer.h (struct _slp_tree): Add def_type member.
(SLP_TREE_DEF_TYPE): New accessor.
* tree-vect-stmts.c (vect_is_simple_use): Remove BB vectorization
hack.
* tree-vect-slp.c (vect_create_new_slp_node): Initialize
SLP_TREE_DEF_TYPE.
(vect_build_slp_tree): When a node is to be built up from scalars
do not push a NULL as child but instead set its def_type to
vect_external_def.
(vect_analyze_slp_cost_1): Check for child def-type instead
of NULL.
(vect_detect_hybrid_slp_stmts): Likewise.
(vect_bb_slp_scalar_cost): Likewise.
(vect_get_slp_defs): Likewise.
(vect_slp_analyze_node_operations): Likewise. Before
processing node push the children def-types to the underlying
stmts vinfo and restore it afterwards.
(vect_schedule_slp_instance): Likewise.
(vect_slp_analyze_bb_1): Do not mark stmts not in SLP instances
as not vectorizable.
2015-12-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/68775 PR tree-optimization/68775
* tree-vect-slp.c (vect_build_slp_tree): Make sure to apply * tree-vect-slp.c (vect_build_slp_tree): Make sure to apply
a operand swapping even if replacing the op with scalars. a operand swapping even if replacing the op with scalars.
2015-12-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/68852
* g++.dg/torture/pr68852.C: New testcase.
2015-12-14 Alexander Monakov <amonakov@ispras.ru> 2015-12-14 Alexander Monakov <amonakov@ispras.ru>
* gcc.dg/builtin-return-1.c: Correct effective-target test. * gcc.dg/builtin-return-1.c: Correct effective-target test.
......
/* { dg-do compile } */
struct A {
double x, y, z, w;
A() {}
A(double, double p2, double p3, double) : y(p2), z(p3) {}
void m_fn1();
};
struct B {
double x, y;
};
struct D : A {
D() {}
D(double p1, double p2, double p3, double p4) : A(p1, p2, p3, p4) {}
};
class C {
public:
float _11, _12, _13, _14;
float _21, _22, _23, _24;
float _31, _32, _33, _34;
float _41, _42, _43, _44;
D m_fn2(B p1) {
double z(p1.x + _43);
return *this * D(p1.x, p1.y, z, 1);
}
int ProjectRectBounds_next;
B __trans_tmp_3;
int m_fn3(int) {
B a, b;
D c[1];
b = __trans_tmp_3;
c[2] = m_fn2(b);
c[3] = m_fn2(a);
c[ProjectRectBounds_next].m_fn1();
}
D operator*(D p1) {
D d;
d.x = p1.x * _11 + p1.y * _21 + p1.z * _31 + _41;
d.y = p1.x * _12 + p1.y * _22 + p1.z * _32 + _42;
d.z = p1.x * _13 + p1.y * _23 + p1.z * _33 + _43;
d.w = p1.x * _14 + p1.y * _24 + p1.z * _34 + _44;
return d;
}
};
void fn1() {
C e;
int f = e.m_fn3(f);
}
...@@ -51,9 +51,6 @@ vect_free_slp_tree (slp_tree node) ...@@ -51,9 +51,6 @@ vect_free_slp_tree (slp_tree node)
int i; int i;
slp_tree child; slp_tree child;
if (!node)
return;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child) FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
vect_free_slp_tree (child); vect_free_slp_tree (child);
...@@ -103,6 +100,7 @@ vect_create_new_slp_node (vec<gimple *> scalar_stmts) ...@@ -103,6 +100,7 @@ vect_create_new_slp_node (vec<gimple *> scalar_stmts)
SLP_TREE_CHILDREN (node).create (nops); SLP_TREE_CHILDREN (node).create (nops);
SLP_TREE_LOAD_PERMUTATION (node) = vNULL; SLP_TREE_LOAD_PERMUTATION (node) = vNULL;
SLP_TREE_TWO_OPERATORS (node) = false; SLP_TREE_TWO_OPERATORS (node) = false;
SLP_TREE_DEF_TYPE (node) = vect_internal_def;
return node; return node;
} }
...@@ -938,7 +936,7 @@ vect_build_slp_tree (vec_info *vinfo, ...@@ -938,7 +936,7 @@ vect_build_slp_tree (vec_info *vinfo,
slp_tree grandchild; slp_tree grandchild;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (child), j, grandchild) FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (child), j, grandchild)
if (grandchild != NULL) if (SLP_TREE_DEF_TYPE (grandchild) == vect_internal_def)
break; break;
if (!grandchild) if (!grandchild)
{ {
...@@ -953,8 +951,8 @@ vect_build_slp_tree (vec_info *vinfo, ...@@ -953,8 +951,8 @@ vect_build_slp_tree (vec_info *vinfo,
"Building parent vector operands from " "Building parent vector operands from "
"scalars instead\n"); "scalars instead\n");
oprnd_info->def_stmts = vNULL; oprnd_info->def_stmts = vNULL;
vect_free_slp_tree (child); SLP_TREE_DEF_TYPE (child) = vect_external_def;
SLP_TREE_CHILDREN (*node).quick_push (NULL); SLP_TREE_CHILDREN (*node).quick_push (child);
continue; continue;
} }
} }
...@@ -992,8 +990,8 @@ vect_build_slp_tree (vec_info *vinfo, ...@@ -992,8 +990,8 @@ vect_build_slp_tree (vec_info *vinfo,
dump_printf_loc (MSG_NOTE, vect_location, dump_printf_loc (MSG_NOTE, vect_location,
"Building vector operands from scalars\n"); "Building vector operands from scalars\n");
oprnd_info->def_stmts = vNULL; oprnd_info->def_stmts = vNULL;
vect_free_slp_tree (child); SLP_TREE_DEF_TYPE (child) = vect_external_def;
SLP_TREE_CHILDREN (*node).quick_push (NULL); SLP_TREE_CHILDREN (*node).quick_push (child);
continue; continue;
} }
...@@ -1066,7 +1064,7 @@ vect_build_slp_tree (vec_info *vinfo, ...@@ -1066,7 +1064,7 @@ vect_build_slp_tree (vec_info *vinfo,
slp_tree grandchild; slp_tree grandchild;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (child), j, grandchild) FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (child), j, grandchild)
if (grandchild != NULL) if (SLP_TREE_DEF_TYPE (grandchild) == vect_internal_def)
break; break;
if (!grandchild) if (!grandchild)
{ {
...@@ -1081,8 +1079,8 @@ vect_build_slp_tree (vec_info *vinfo, ...@@ -1081,8 +1079,8 @@ vect_build_slp_tree (vec_info *vinfo,
"Building parent vector operands from " "Building parent vector operands from "
"scalars instead\n"); "scalars instead\n");
oprnd_info->def_stmts = vNULL; oprnd_info->def_stmts = vNULL;
vect_free_slp_tree (child); SLP_TREE_DEF_TYPE (child) = vect_external_def;
SLP_TREE_CHILDREN (*node).quick_push (NULL); SLP_TREE_CHILDREN (*node).quick_push (child);
continue; continue;
} }
} }
...@@ -1117,10 +1115,9 @@ vect_print_slp_tree (int dump_kind, location_t loc, slp_tree node) ...@@ -1117,10 +1115,9 @@ vect_print_slp_tree (int dump_kind, location_t loc, slp_tree node)
gimple *stmt; gimple *stmt;
slp_tree child; slp_tree child;
if (!node) dump_printf_loc (dump_kind, loc, "node%s\n",
return; SLP_TREE_DEF_TYPE (node) != vect_internal_def
? " (external)" : "");
dump_printf_loc (dump_kind, loc, "node\n");
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt) FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt)
{ {
dump_printf_loc (dump_kind, loc, "\tstmt %d ", i); dump_printf_loc (dump_kind, loc, "\tstmt %d ", i);
...@@ -1143,7 +1140,7 @@ vect_mark_slp_stmts (slp_tree node, enum slp_vect_type mark, int j) ...@@ -1143,7 +1140,7 @@ vect_mark_slp_stmts (slp_tree node, enum slp_vect_type mark, int j)
gimple *stmt; gimple *stmt;
slp_tree child; slp_tree child;
if (!node) if (SLP_TREE_DEF_TYPE (node) != vect_internal_def)
return; return;
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt) FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt)
...@@ -1165,7 +1162,7 @@ vect_mark_slp_stmts_relevant (slp_tree node) ...@@ -1165,7 +1162,7 @@ vect_mark_slp_stmts_relevant (slp_tree node)
stmt_vec_info stmt_info; stmt_vec_info stmt_info;
slp_tree child; slp_tree child;
if (!node) if (SLP_TREE_DEF_TYPE (node) != vect_internal_def)
return; return;
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt) FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt)
...@@ -1403,7 +1400,7 @@ vect_analyze_slp_cost_1 (slp_instance instance, slp_tree node, ...@@ -1403,7 +1400,7 @@ vect_analyze_slp_cost_1 (slp_instance instance, slp_tree node,
stmt_vector_for_cost *body_cost_vec, stmt_vector_for_cost *body_cost_vec,
unsigned ncopies_for_cost) unsigned ncopies_for_cost)
{ {
unsigned i; unsigned i, j;
slp_tree child; slp_tree child;
gimple *stmt, *s; gimple *stmt, *s;
stmt_vec_info stmt_info; stmt_vec_info stmt_info;
...@@ -1412,7 +1409,7 @@ vect_analyze_slp_cost_1 (slp_instance instance, slp_tree node, ...@@ -1412,7 +1409,7 @@ vect_analyze_slp_cost_1 (slp_instance instance, slp_tree node,
/* Recurse down the SLP tree. */ /* Recurse down the SLP tree. */
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child) FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
if (child) if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
vect_analyze_slp_cost_1 (instance, child, prologue_cost_vec, vect_analyze_slp_cost_1 (instance, child, prologue_cost_vec,
body_cost_vec, ncopies_for_cost); body_cost_vec, ncopies_for_cost);
...@@ -1467,9 +1464,16 @@ vect_analyze_slp_cost_1 (slp_instance instance, slp_tree node, ...@@ -1467,9 +1464,16 @@ vect_analyze_slp_cost_1 (slp_instance instance, slp_tree node,
} }
} }
/* Push SLP node def-type to stmts. */
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
if (SLP_TREE_DEF_TYPE (child) != vect_internal_def)
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (child), j, stmt)
STMT_VINFO_DEF_TYPE (vinfo_for_stmt (stmt)) = SLP_TREE_DEF_TYPE (child);
/* Scan operands and account for prologue cost of constants/externals. /* Scan operands and account for prologue cost of constants/externals.
??? This over-estimates cost for multiple uses and should be ??? This over-estimates cost for multiple uses and should be
re-engineered. */ re-engineered. */
stmt = SLP_TREE_SCALAR_STMTS (node)[0];
lhs = gimple_get_lhs (stmt); lhs = gimple_get_lhs (stmt);
for (i = 0; i < gimple_num_ops (stmt); ++i) for (i = 0; i < gimple_num_ops (stmt); ++i)
{ {
...@@ -1492,6 +1496,12 @@ vect_analyze_slp_cost_1 (slp_instance instance, slp_tree node, ...@@ -1492,6 +1496,12 @@ vect_analyze_slp_cost_1 (slp_instance instance, slp_tree node,
stmt_info, 0, vect_prologue); stmt_info, 0, vect_prologue);
} }
} }
/* Restore stmt def-types. */
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
if (SLP_TREE_DEF_TYPE (child) != vect_internal_def)
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (child), j, stmt)
STMT_VINFO_DEF_TYPE (vinfo_for_stmt (stmt)) = vect_internal_def;
} }
/* Compute the cost for the SLP instance INSTANCE. */ /* Compute the cost for the SLP instance INSTANCE. */
...@@ -1798,6 +1808,33 @@ vect_analyze_slp_instance (vec_info *vinfo, ...@@ -1798,6 +1808,33 @@ vect_analyze_slp_instance (vec_info *vinfo,
} }
} }
/* If the loads and stores can be handled with load/store-lane
instructions do not generate this SLP instance. */
if (is_a <loop_vec_info> (vinfo)
&& loads_permuted
&& dr && vect_store_lanes_supported (vectype, group_size))
{
slp_tree load_node;
FOR_EACH_VEC_ELT (loads, i, load_node)
{
gimple *first_stmt = GROUP_FIRST_ELEMENT
(vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (load_node)[0]));
stmt_vec_info stmt_vinfo = vinfo_for_stmt (first_stmt);
if (! vect_load_lanes_supported (STMT_VINFO_VECTYPE (stmt_vinfo),
GROUP_SIZE (stmt_vinfo)))
break;
}
if (i == loads.length ())
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Built SLP cancelled: can use "
"load/store-lanes\n");
vect_free_slp_instance (new_instance);
return false;
}
}
vinfo->slp_instances.safe_push (new_instance); vinfo->slp_instances.safe_push (new_instance);
if (dump_enabled_p ()) if (dump_enabled_p ())
...@@ -2007,7 +2044,7 @@ vect_detect_hybrid_slp_stmts (slp_tree node, unsigned i, slp_vect_type stype) ...@@ -2007,7 +2044,7 @@ vect_detect_hybrid_slp_stmts (slp_tree node, unsigned i, slp_vect_type stype)
} }
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child) FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child)
if (child) if (SLP_TREE_DEF_TYPE (child) != vect_external_def)
vect_detect_hybrid_slp_stmts (child, i, stype); vect_detect_hybrid_slp_stmts (child, i, stype);
} }
...@@ -2188,17 +2225,24 @@ static bool ...@@ -2188,17 +2225,24 @@ static bool
vect_slp_analyze_node_operations (slp_tree node) vect_slp_analyze_node_operations (slp_tree node)
{ {
bool dummy; bool dummy;
int i; int i, j;
gimple *stmt; gimple *stmt;
slp_tree child; slp_tree child;
if (!node) if (SLP_TREE_DEF_TYPE (node) != vect_internal_def)
return true; return true;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child) FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
if (!vect_slp_analyze_node_operations (child)) if (!vect_slp_analyze_node_operations (child))
return false; return false;
/* Push SLP node def-type to stmts. */
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
if (SLP_TREE_DEF_TYPE (child) != vect_internal_def)
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (child), j, stmt)
STMT_VINFO_DEF_TYPE (vinfo_for_stmt (stmt)) = SLP_TREE_DEF_TYPE (child);
bool res = true;
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt) FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt)
{ {
stmt_vec_info stmt_info = vinfo_for_stmt (stmt); stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
...@@ -2206,10 +2250,19 @@ vect_slp_analyze_node_operations (slp_tree node) ...@@ -2206,10 +2250,19 @@ vect_slp_analyze_node_operations (slp_tree node)
gcc_assert (STMT_SLP_TYPE (stmt_info) != loop_vect); gcc_assert (STMT_SLP_TYPE (stmt_info) != loop_vect);
if (!vect_analyze_stmt (stmt, &dummy, node)) if (!vect_analyze_stmt (stmt, &dummy, node))
return false; {
res = false;
break;
}
} }
return true; /* Restore stmt def-types. */
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
if (SLP_TREE_DEF_TYPE (child) != vect_internal_def)
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (child), j, stmt)
STMT_VINFO_DEF_TYPE (vinfo_for_stmt (stmt)) = vect_internal_def;
return res;
} }
...@@ -2289,7 +2342,7 @@ vect_bb_slp_scalar_cost (basic_block bb, ...@@ -2289,7 +2342,7 @@ vect_bb_slp_scalar_cost (basic_block bb,
if (!is_gimple_debug (use_stmt) if (!is_gimple_debug (use_stmt)
&& (! vect_stmt_in_region_p (vinfo_for_stmt (stmt)->vinfo, && (! vect_stmt_in_region_p (vinfo_for_stmt (stmt)->vinfo,
use_stmt) use_stmt)
|| !STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (use_stmt)))) || ! PURE_SLP_STMT (vinfo_for_stmt (use_stmt))))
{ {
(*life)[i] = true; (*life)[i] = true;
BREAK_FROM_IMM_USE_STMT (use_iter); BREAK_FROM_IMM_USE_STMT (use_iter);
...@@ -2313,7 +2366,7 @@ vect_bb_slp_scalar_cost (basic_block bb, ...@@ -2313,7 +2366,7 @@ vect_bb_slp_scalar_cost (basic_block bb,
} }
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child) FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
if (child) if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
scalar_cost += vect_bb_slp_scalar_cost (bb, child, life); scalar_cost += vect_bb_slp_scalar_cost (bb, child, life);
return scalar_cost; return scalar_cost;
...@@ -2502,15 +2555,6 @@ vect_slp_analyze_bb_1 (gimple_stmt_iterator region_begin, ...@@ -2502,15 +2555,6 @@ vect_slp_analyze_bb_1 (gimple_stmt_iterator region_begin,
return NULL; return NULL;
} }
/* Mark all the statements that we do not want to vectorize. */
for (gimple_stmt_iterator gsi = bb_vinfo->region_begin;
gsi_stmt (gsi) != gsi_stmt (bb_vinfo->region_end); gsi_next (&gsi))
{
stmt_vec_info vinfo = vinfo_for_stmt (gsi_stmt (gsi));
if (STMT_SLP_TYPE (vinfo) != pure_slp)
STMT_VINFO_VECTORIZABLE (vinfo) = false;
}
if (!vect_slp_analyze_operations (BB_VINFO_SLP_INSTANCES (bb_vinfo), if (!vect_slp_analyze_operations (BB_VINFO_SLP_INSTANCES (bb_vinfo),
BB_VINFO_TARGET_COST_DATA (bb_vinfo))) BB_VINFO_TARGET_COST_DATA (bb_vinfo)))
{ {
...@@ -3088,7 +3132,7 @@ vect_get_slp_defs (vec<tree> ops, slp_tree slp_node, ...@@ -3088,7 +3132,7 @@ vect_get_slp_defs (vec<tree> ops, slp_tree slp_node,
child = SLP_TREE_CHILDREN (slp_node)[child_index]; child = SLP_TREE_CHILDREN (slp_node)[child_index];
/* We have to check both pattern and original def, if available. */ /* We have to check both pattern and original def, if available. */
if (child) if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
{ {
gimple *first_def = SLP_TREE_SCALAR_STMTS (child)[0]; gimple *first_def = SLP_TREE_SCALAR_STMTS (child)[0];
gimple *related gimple *related
...@@ -3377,15 +3421,21 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance, ...@@ -3377,15 +3421,21 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance,
stmt_vec_info stmt_info; stmt_vec_info stmt_info;
unsigned int vec_stmts_size, nunits, group_size; unsigned int vec_stmts_size, nunits, group_size;
tree vectype; tree vectype;
int i; int i, j;
slp_tree child; slp_tree child;
if (!node) if (SLP_TREE_DEF_TYPE (node) != vect_internal_def)
return false; return false;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child) FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
vect_schedule_slp_instance (child, instance, vectorization_factor); vect_schedule_slp_instance (child, instance, vectorization_factor);
/* Push SLP node def-type to stmts. */
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
if (SLP_TREE_DEF_TYPE (child) != vect_internal_def)
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (child), j, stmt)
STMT_VINFO_DEF_TYPE (vinfo_for_stmt (stmt)) = SLP_TREE_DEF_TYPE (child);
stmt = SLP_TREE_SCALAR_STMTS (node)[0]; stmt = SLP_TREE_SCALAR_STMTS (node)[0];
stmt_info = vinfo_for_stmt (stmt); stmt_info = vinfo_for_stmt (stmt);
...@@ -3504,6 +3554,13 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance, ...@@ -3504,6 +3554,13 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance,
} }
} }
is_store = vect_transform_stmt (stmt, &si, &grouped_store, node, instance); is_store = vect_transform_stmt (stmt, &si, &grouped_store, node, instance);
/* Restore stmt def-types. */
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
if (SLP_TREE_DEF_TYPE (child) != vect_internal_def)
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (child), j, stmt)
STMT_VINFO_DEF_TYPE (vinfo_for_stmt (stmt)) = vect_internal_def;
return is_store; return is_store;
} }
...@@ -3522,7 +3579,7 @@ vect_remove_slp_scalar_calls (slp_tree node) ...@@ -3522,7 +3579,7 @@ vect_remove_slp_scalar_calls (slp_tree node)
tree lhs; tree lhs;
stmt_vec_info stmt_info; stmt_vec_info stmt_info;
if (!node) if (SLP_TREE_DEF_TYPE (node) != vect_internal_def)
return; return;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child) FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
......
...@@ -8649,9 +8649,6 @@ vect_is_simple_use (tree operand, vec_info *vinfo, ...@@ -8649,9 +8649,6 @@ vect_is_simple_use (tree operand, vec_info *vinfo,
else else
{ {
stmt_vec_info stmt_vinfo = vinfo_for_stmt (*def_stmt); stmt_vec_info stmt_vinfo = vinfo_for_stmt (*def_stmt);
if (is_a <bb_vec_info> (vinfo) && !STMT_VINFO_VECTORIZABLE (stmt_vinfo))
*dt = vect_external_def;
else
*dt = STMT_VINFO_DEF_TYPE (stmt_vinfo); *dt = STMT_VINFO_DEF_TYPE (stmt_vinfo);
} }
......
...@@ -107,6 +107,8 @@ struct _slp_tree { ...@@ -107,6 +107,8 @@ struct _slp_tree {
unsigned int vec_stmts_size; unsigned int vec_stmts_size;
/* Whether the scalar computations use two different operators. */ /* Whether the scalar computations use two different operators. */
bool two_operators; bool two_operators;
/* The DEF type of this node. */
enum vect_def_type def_type;
}; };
...@@ -139,6 +141,7 @@ typedef struct _slp_instance { ...@@ -139,6 +141,7 @@ typedef struct _slp_instance {
#define SLP_TREE_NUMBER_OF_VEC_STMTS(S) (S)->vec_stmts_size #define SLP_TREE_NUMBER_OF_VEC_STMTS(S) (S)->vec_stmts_size
#define SLP_TREE_LOAD_PERMUTATION(S) (S)->load_permutation #define SLP_TREE_LOAD_PERMUTATION(S) (S)->load_permutation
#define SLP_TREE_TWO_OPERATORS(S) (S)->two_operators #define SLP_TREE_TWO_OPERATORS(S) (S)->two_operators
#define SLP_TREE_DEF_TYPE(S) (S)->def_type
......
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