aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-vectorizer.c')
-rw-r--r--gcc/tree-vectorizer.c122
1 files changed, 39 insertions, 83 deletions
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index f229fd4..65214cc 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -540,25 +540,18 @@ vect_create_index_for_array_ref (tree stmt, block_stmt_iterator *bsi)
varray_type access_fns = DR_ACCESS_FNS (dr);
/* FORNOW: handling only one dimensional arrays. */
- if (VARRAY_ACTIVE_SIZE (access_fns) != 1)
- abort ();
-
- if (!vectorization_factor)
- abort ();
+ gcc_assert (VARRAY_ACTIVE_SIZE (access_fns) == 1);
+ gcc_assert (vectorization_factor);
#endif
access_fn = DR_ACCESS_FN (dr, 0);
ok = vect_is_simple_iv_evolution (loopnum, access_fn, &init, &step, true)
&& vect_get_first_index (expr, &array_first_index);
-#ifdef ENABLE_CHECKING
- if (!ok)
- abort ();
+ gcc_assert (ok);
/* FORNOW: Handling only constant 'init'. */
- if (TREE_CODE (init) != INTEGER_CST)
- abort ();
-#endif
+ gcc_assert (TREE_CODE (init) == INTEGER_CST);
vf = build_int_cst (unsigned_type_node, vectorization_factor);
@@ -636,8 +629,7 @@ vect_align_data_ref (tree stmt)
/* FORNOW: can't handle misaligned accesses;
all accesses expected to be aligned. */
- if (!aligned_access_p (dr))
- abort ();
+ gcc_assert (aligned_access_p (dr));
}
@@ -706,12 +698,9 @@ vect_create_data_ref (tree stmt, block_stmt_iterator *bsi)
get_name (addr_ref));
add_referenced_tmp_var (vect_ptr);
-#ifdef ENABLE_CHECKING
- if (TREE_CODE (addr_ref) != VAR_DECL
- && TREE_CODE (addr_ref) != COMPONENT_REF
- && TREE_CODE (addr_ref) != SSA_NAME)
- abort ();
-#endif
+ gcc_assert (TREE_CODE (addr_ref) == VAR_DECL
+ || TREE_CODE (addr_ref) == COMPONENT_REF
+ || TREE_CODE (addr_ref) == SSA_NAME);
if (vect_debug_details (NULL))
{
@@ -732,10 +721,7 @@ vect_create_data_ref (tree stmt, block_stmt_iterator *bsi)
/* Handle aliasing: */
tag = STMT_VINFO_MEMTAG (stmt_info);
-#ifdef ENABLE_CHECKING
- if (!tag)
- abort ();
-#endif
+ gcc_assert (tag);
get_var_ann (vect_ptr)->type_mem_tag = tag;
/* Mark for renaming all aliased variables
@@ -794,10 +780,7 @@ vect_create_destination_var (tree scalar_dest, tree vectype)
tree vec_dest;
const char *new_name;
-#ifdef ENABLE_CHECKING
- if (TREE_CODE (scalar_dest) != SSA_NAME)
- abort ();
-#endif
+ gcc_assert (TREE_CODE (scalar_dest) == SSA_NAME);
new_name = get_name (scalar_dest);
if (!new_name)
@@ -907,10 +890,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt)
return vect_init_vector (stmt, vec_cst);
}
-#ifdef ENABLE_CHECKING
- if (TREE_CODE (op) != SSA_NAME)
- abort ();
-#endif
+ gcc_assert (TREE_CODE (op) == SSA_NAME);
/** ===> Case 2: operand is an SSA_NAME - find the stmt that defines it. **/
@@ -931,10 +911,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt)
/* Get the def from the vectorized stmt. */
vec_stmt = STMT_VINFO_VEC_STMT (def_stmt_info);
-#ifdef ENABLE_CHECKING
- if (!vec_stmt)
- abort ();
-#endif
+ gcc_assert (vec_stmt);
vec_oprnd = TREE_OPERAND (vec_stmt, 0);
return vec_oprnd;
}
@@ -948,7 +925,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt)
{
if (vect_debug_details (NULL))
fprintf (dump_file, "reduction/induction - unsupported.");
- abort (); /* FORNOW no support for reduction/induction. */
+ internal_error ("no support for reduction/induction"); /* FORNOW */
}
@@ -965,10 +942,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt)
break;
case NOP_EXPR:
def = TREE_OPERAND (def_stmt, 0);
-#ifdef ENABLE_CHECKING
- if (!IS_EMPTY_STMT (def_stmt))
- abort ();
-#endif
+ gcc_assert (IS_EMPTY_STMT (def_stmt));
def = op;
break;
default:
@@ -977,7 +951,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt)
fprintf (dump_file, "unsupported defining stmt: ");
print_generic_expr (dump_file, def_stmt, TDF_SLIM);
}
- abort ();
+ internal_error ("unsupported defining stmt");
}
/* Build a tree with vector elements. Create 'vec_inv = {inv,inv,..,inv}' */
@@ -1017,10 +991,7 @@ vect_finish_stmt_generation (tree stmt, tree vec_stmt, block_stmt_iterator *bsi)
while (stmt != bsi_stmt (*bsi) && !bsi_end_p (*bsi))
bsi_next (bsi);
-#ifdef ENABLE_CHECKING
- if (stmt != bsi_stmt (*bsi))
- abort ();
-#endif
+ gcc_assert (stmt == bsi_stmt (*bsi));
}
@@ -1352,33 +1323,34 @@ vect_transform_stmt (tree stmt, block_stmt_iterator *bsi)
bool is_store = false;
tree vec_stmt = NULL_TREE;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ bool done;
switch (STMT_VINFO_TYPE (stmt_info))
{
case op_vec_info_type:
- if (!vectorizable_operation (stmt, bsi, &vec_stmt))
- abort ();
+ done = vectorizable_operation (stmt, bsi, &vec_stmt);
+ gcc_assert (done);
break;
case assignment_vec_info_type:
- if (!vectorizable_assignment (stmt, bsi, &vec_stmt))
- abort ();
+ done = vectorizable_assignment (stmt, bsi, &vec_stmt);
+ gcc_assert (done);
break;
case load_vec_info_type:
- if (!vectorizable_load (stmt, bsi, &vec_stmt))
- abort ();
+ done = vectorizable_load (stmt, bsi, &vec_stmt);
+ gcc_assert (done);
break;
case store_vec_info_type:
- if (!vectorizable_store (stmt, bsi, &vec_stmt))
- abort ();
+ done = vectorizable_store (stmt, bsi, &vec_stmt);
+ gcc_assert (done);
is_store = true;
break;
default:
if (vect_debug_details (NULL))
fprintf (dump_file, "stmt not supported.");
- abort ();
+ gcc_unreachable ();
}
STMT_VINFO_VEC_STMT (stmt_info) = vec_stmt;
@@ -1406,27 +1378,17 @@ vect_transform_loop_bound (loop_vec_info loop_vinfo)
tree cond;
tree lb_type;
-#ifdef ENABLE_CHECKING
- if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
- abort ();
-#endif
+ gcc_assert (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo));
old_N = LOOP_VINFO_NITERS (loop_vinfo);
vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
-#ifdef ENABLE_CHECKING
/* FORNOW:
assuming number-of-iterations divides by the vectorization factor. */
- if (old_N % vf)
- abort ();
-#endif
+ gcc_assert (!(old_N % vf));
orig_cond_expr = LOOP_VINFO_EXIT_COND (loop_vinfo);
-#ifdef ENABLE_CHECKING
- if (!orig_cond_expr)
- abort ();
-#endif
- if (orig_cond_expr != bsi_stmt (loop_exit_bsi))
- abort ();
+ gcc_assert (orig_cond_expr);
+ gcc_assert (orig_cond_expr == bsi_stmt (loop_exit_bsi));
create_iv (integer_zero_node, integer_one_node, NULL_TREE, loop,
&loop_exit_bsi, false, &indx_before_incr, &indx_after_incr);
@@ -1434,8 +1396,7 @@ vect_transform_loop_bound (loop_vec_info loop_vinfo)
/* bsi_insert is using BSI_NEW_STMT. We need to bump it back
to point to the exit condition. */
bsi_next (&loop_exit_bsi);
- if (bsi_stmt (loop_exit_bsi) != orig_cond_expr)
- abort ();
+ gcc_assert (bsi_stmt (loop_exit_bsi) == orig_cond_expr);
/* new loop exit test: */
lb_type = TREE_TYPE (TREE_OPERAND (TREE_OPERAND (orig_cond_expr, 0), 1));
@@ -1484,9 +1445,8 @@ vect_transform_loop (loop_vec_info loop_vinfo,
/* 1) Make sure the loop header has exactly two entries
2) Make sure we have a preheader basic block. */
- if (!loop->header->pred->pred_next
- || loop->header->pred->pred_next->pred_next)
- abort ();
+ gcc_assert (loop->header->pred->pred_next);
+ gcc_assert (!loop->header->pred->pred_next->pred_next);
loop_split_edge_with (loop_preheader_edge (loop), NULL);
@@ -1515,10 +1475,7 @@ vect_transform_loop (loop_vec_info loop_vinfo,
print_generic_expr (dump_file, stmt, TDF_SLIM);
}
stmt_info = vinfo_for_stmt (stmt);
-#ifdef ENABLE_CHECKING
- if (!stmt_info)
- abort ();
-#endif
+ gcc_assert (stmt_info);
if (!STMT_VINFO_RELEVANT_P (stmt_info))
{
bsi_next (&si);
@@ -1528,8 +1485,8 @@ vect_transform_loop (loop_vec_info loop_vinfo,
/* FORNOW: Verify that all stmts operate on the same number of
units and no inner unrolling is necessary. */
vectype = STMT_VINFO_VECTYPE (stmt_info);
- if (GET_MODE_NUNITS (TYPE_MODE (vectype)) != vectorization_factor)
- abort ();
+ gcc_assert (GET_MODE_NUNITS (TYPE_MODE (vectype))
+ == vectorization_factor);
#endif
/* -------- vectorize statement ------------ */
if (vect_debug_details (NULL))
@@ -1668,10 +1625,9 @@ vect_analyze_operations (loop_vec_info loop_vinfo)
fprintf (dump_file, "==> examining statement: ");
print_generic_expr (dump_file, stmt, TDF_SLIM);
}
-#ifdef ENABLE_CHECKING
- if (!stmt_info)
- abort ();
-#endif
+
+ gcc_assert (stmt_info);
+
/* skip stmts which do not need to be vectorized.
this is expected to include:
- the COND_EXPR which is the loop exit condition