tree-vect-analyze.c (vect_build_slp_tree): Return false if vectype cannot be determined for the scalar type.

* tree-vect-analyze.c (vect_build_slp_tree): Return false if
	vectype cannot be determined for the scalar type.
	(vect_analyze_slp_instance): Likewise.
	* tree-vect-transform.c (vect_model_reduction_cost): Change the
	return type to bool. Return false if vectype cannot be determined 
	for the scalar type.
	(vect_get_constant_vectors): Return false if vectype cannot be
	determined for the scalar type.
	(get_initial_def_for_induction, vect_get_vec_def_for_operand,
	get_initial_def_for_reduction, vect_create_epilog_for_reduction,
	vectorizable_reduction): Likewise.

From-SVN: r129598
This commit is contained in:
Ira Rosen 2007-10-24 07:51:09 +00:00 committed by Ira Rosen
parent 6f4fd5362d
commit 20e545c381
3 changed files with 72 additions and 5 deletions

View File

@ -1,3 +1,17 @@
2007-10-24 Ira Rosen <irar@il.ibm.com>
* tree-vect-analyze.c (vect_build_slp_tree): Return false if
vectype cannot be determined for the scalar type.
(vect_analyze_slp_instance): Likewise.
* tree-vect-transform.c (vect_model_reduction_cost): Change the
return type to bool. Return false if vectype cannot be determined
for the scalar type.
(vect_get_constant_vectors): Return false if vectype cannot be
determined for the scalar type.
(get_initial_def_for_induction, vect_get_vec_def_for_operand,
get_initial_def_for_reduction, vect_create_epilog_for_reduction,
vectorizable_reduction): Likewise.
2007-10-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
* config.gcc: For a FreeBSD target, parse the value of ${target}

View File

@ -2682,6 +2682,16 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
scalar_type = TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 0));
vectype = get_vectype_for_scalar_type (scalar_type);
if (!vectype)
{
if (vect_print_dump_info (REPORT_SLP))
{
fprintf (vect_dump, "Build SLP failed: unsupported data-type ");
print_generic_expr (vect_dump, scalar_type, TDF_SLIM);
}
return false;
}
gcc_assert (LOOP_VINFO_VECT_FACTOR (loop_vinfo));
vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
ncopies = vectorization_factor / TYPE_VECTOR_SUBPARTS (vectype);
@ -2987,6 +2997,16 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, tree stmt)
/* FORNOW: multiple types are not supported. */
scalar_type = TREE_TYPE (DR_REF (STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt))));
vectype = get_vectype_for_scalar_type (scalar_type);
if (!vectype)
{
if (vect_print_dump_info (REPORT_SLP))
{
fprintf (vect_dump, "Build SLP failed: unsupported data-type ");
print_generic_expr (vect_dump, scalar_type, TDF_SLIM);
}
return false;
}
nunits = TYPE_VECTOR_SUBPARTS (vectype);
vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
ncopies = vectorization_factor / nunits;

View File

@ -380,7 +380,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
generated within the strip-mine loop, the initial definition before
the loop, and the epilogue code that must be generated. */
static void
static bool
vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
int ncopies)
{
@ -401,6 +401,16 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
reduction_op = TREE_OPERAND (operation, op_type-1);
vectype = get_vectype_for_scalar_type (TREE_TYPE (reduction_op));
if (!vectype)
{
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "unsupported data-type ");
print_generic_expr (vect_dump, TREE_TYPE (reduction_op), TDF_SLIM);
}
return false;
}
mode = TYPE_MODE (vectype);
orig_stmt = STMT_VINFO_RELATED_STMT (stmt_info);
@ -452,6 +462,8 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
fprintf (vect_dump, "vect_model_reduction_cost: inside_cost = %d, "
"outside_cost = %d .", STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info),
STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info));
return true;
}
@ -1349,6 +1361,7 @@ vect_get_constant_vectors (slp_tree slp_node, VEC(tree,heap) **vec_oprnds,
number_of_places_left_in_vector = nunits;
vector_type = get_vectype_for_scalar_type (TREE_TYPE (op));
gcc_assert (vector_type);
vec_cst = build_constructor_from_list (vector_type, t);
VEC_quick_push (tree, voprnds,
vect_init_vector (stmt, vec_cst, vector_type,
@ -1473,8 +1486,8 @@ get_initial_def_for_induction (tree iv_phi)
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
tree scalar_type = TREE_TYPE (PHI_RESULT_TREE (iv_phi));
tree vectype = get_vectype_for_scalar_type (scalar_type);
int nunits = TYPE_VECTOR_SUBPARTS (vectype);
tree vectype;
int nunits;
edge pe = loop_preheader_edge (loop);
struct loop *iv_loop;
basic_block new_bb;
@ -1488,7 +1501,7 @@ get_initial_def_for_induction (tree iv_phi)
int vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
int i;
bool ok;
int ncopies = vf / nunits;
int ncopies;
tree expr;
stmt_vec_info phi_info = vinfo_for_stmt (iv_phi);
bool nested_in_vect_loop = false;
@ -1501,6 +1514,11 @@ get_initial_def_for_induction (tree iv_phi)
block_stmt_iterator si;
basic_block bb = bb_for_stmt (iv_phi);
vectype = get_vectype_for_scalar_type (scalar_type);
gcc_assert (vectype);
nunits = TYPE_VECTOR_SUBPARTS (vectype);
ncopies = vf / nunits;
gcc_assert (phi_info);
gcc_assert (ncopies >= 1);
@ -1791,6 +1809,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt, tree *scalar_def)
t = tree_cons (NULL_TREE, op, t);
}
vector_type = get_vectype_for_scalar_type (TREE_TYPE (op));
gcc_assert (vector_type);
vec_cst = build_vector (vector_type, t);
return vect_init_vector (stmt, vec_cst, vector_type, NULL);
@ -1813,6 +1832,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt, tree *scalar_def)
/* FIXME: use build_constructor directly. */
vector_type = get_vectype_for_scalar_type (TREE_TYPE (def));
gcc_assert (vector_type);
vec_inv = build_constructor_from_list (vector_type, t);
return vect_init_vector (stmt, vec_inv, vector_type, NULL);
}
@ -2112,6 +2132,7 @@ get_initial_def_for_reduction (tree stmt, tree init_val, tree *adjustment_def)
for (i = nunits - 1; i >= 0; --i)
t = tree_cons (NULL_TREE, def_for_init, t);
vector_type = get_vectype_for_scalar_type (TREE_TYPE (def_for_init));
gcc_assert (vector_type);
init_def = build_vector (vector_type, t);
break;
@ -2222,6 +2243,7 @@ vect_create_epilog_for_reduction (tree vect_def, tree stmt,
op_type = TREE_OPERAND_LENGTH (operation);
reduction_op = TREE_OPERAND (operation, op_type-1);
vectype = get_vectype_for_scalar_type (TREE_TYPE (reduction_op));
gcc_assert (vectype);
mode = TYPE_MODE (vectype);
/*** 1. Create the reduction def-use cycle ***/
@ -2795,6 +2817,16 @@ vectorizable_reduction (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
reduction variable, and get the tree-code from orig_stmt. */
orig_code = TREE_CODE (GIMPLE_STMT_OPERAND (orig_stmt, 1));
vectype = get_vectype_for_scalar_type (TREE_TYPE (def));
if (!vectype)
{
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "unsupported data-type ");
print_generic_expr (vect_dump, TREE_TYPE (def), TDF_SLIM);
}
return false;
}
vec_mode = TYPE_MODE (vectype);
}
else
@ -2823,7 +2855,8 @@ vectorizable_reduction (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
if (!vec_stmt) /* transformation not required. */
{
STMT_VINFO_TYPE (stmt_info) = reduc_vec_info_type;
vect_model_reduction_cost (stmt_info, epilog_reduc_code, ncopies);
if (!vect_model_reduction_cost (stmt_info, epilog_reduc_code, ncopies))
return false;
return true;
}