diff options
author | Ira Rosen <irar@il.ibm.com> | 2007-10-24 07:51:09 +0000 |
---|---|---|
committer | Ira Rosen <irar@gcc.gnu.org> | 2007-10-24 07:51:09 +0000 |
commit | 20e545c381eecde36210a913e013e588422a3cef (patch) | |
tree | be49be44f7fe1b474532f24bb801a3fab5d4758b /gcc/tree-vect-transform.c | |
parent | 6f4fd5362d14e6ca794b629befd60b7b3aa56a42 (diff) | |
download | gcc-20e545c381eecde36210a913e013e588422a3cef.zip gcc-20e545c381eecde36210a913e013e588422a3cef.tar.gz gcc-20e545c381eecde36210a913e013e588422a3cef.tar.bz2 |
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
Diffstat (limited to 'gcc/tree-vect-transform.c')
-rw-r--r-- | gcc/tree-vect-transform.c | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c index 0578239..81abd36 100644 --- a/gcc/tree-vect-transform.c +++ b/gcc/tree-vect-transform.c @@ -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; } |