Commit cce4ca55 by Dorit Naishlos Committed by Dorit Nuzman

tree-vectorizer.c (slpeel_make_loop_iterate_ntimes): Copy EXPR_LOCUS from…

tree-vectorizer.c (slpeel_make_loop_iterate_ntimes): Copy EXPR_LOCUS from orig_cond to the new cond_stmt.


        * tree-vectorizer.c (slpeel_make_loop_iterate_ntimes): Copy
        EXPR_LOCUS from orig_cond to the new cond_stmt.
        (vect_finish_stmt_generation): Copy EXPR_LOCUS from stmt to
        the new vec_stmt.


        * tree-vectorizer.c (slpeel_make_loop_iterate_ntimes): Call
        standard_iv_increment_position. Remove call to bsi_next
        (no need to bump the iterator anymore).
        (vect_create_index_for_vector_ref): Call
        standard_iv_increment_position. Remove second function argument.
        (vect_finish_stmt_generation): Remove call to bsi_next
        (no need to bump the iterator anymore).
        (vect_create_data_ref_ptr): Remove second argument (bsi) in call
        to vect_create_index_for_vector_ref.


        * tree-vectorizer.c (vect_mark_stmts_to_be_vectorized): Check if
        phis are used out of the loop.

From-SVN: r94651
parent 73aea290
2005-02-03 Dorit Naishlos <dorit@il.ibm.com>
* tree-vectorizer.c (slpeel_make_loop_iterate_ntimes): Copy
EXPR_LOCUS from orig_cond to the new cond_stmt.
(vect_finish_stmt_generation): Copy EXPR_LOCUS from stmt to
the new vec_stmt.
2005-02-03 Dorit Naishlos <dorit@il.ibm.com>
* tree-vectorizer.c (slpeel_make_loop_iterate_ntimes): Call
standard_iv_increment_position. Remove call to bsi_next
(no need to bump the iterator anymore).
(vect_create_index_for_vector_ref): Call
standard_iv_increment_position. Remove second function argument.
(vect_finish_stmt_generation): Remove call to bsi_next
(no need to bump the iterator anymore).
(vect_create_data_ref_ptr): Remove second argument (bsi) in call
to vect_create_index_for_vector_ref.
2005-02-03 Dorit Naishlos <dorit@il.ibm.com>
* tree-vectorizer.c (vect_mark_stmts_to_be_vectorized): Check if
phis are used out of the loop.
2005-02-03 Joseph S. Myers <joseph@codesourcery.com> 2005-02-03 Joseph S. Myers <joseph@codesourcery.com>
PR c/17807 PR c/17807
......
...@@ -236,8 +236,7 @@ static tree vect_strip_conversion (tree); ...@@ -236,8 +236,7 @@ static tree vect_strip_conversion (tree);
static tree vect_create_destination_var (tree, tree); static tree vect_create_destination_var (tree, tree);
static tree vect_create_data_ref_ptr static tree vect_create_data_ref_ptr
(tree, block_stmt_iterator *, tree, tree *, bool); (tree, block_stmt_iterator *, tree, tree *, bool);
static tree vect_create_index_for_vector_ref static tree vect_create_index_for_vector_ref (struct loop *);
(struct loop *, block_stmt_iterator *);
static tree vect_create_addr_base_for_vector_ref (tree, tree *, tree); static tree vect_create_addr_base_for_vector_ref (tree, tree *, tree);
static tree get_vectype_for_scalar_type (tree); static tree get_vectype_for_scalar_type (tree);
static tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *); static tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *);
...@@ -657,23 +656,29 @@ slpeel_make_loop_iterate_ntimes (struct loop *loop, tree niters) ...@@ -657,23 +656,29 @@ slpeel_make_loop_iterate_ntimes (struct loop *loop, tree niters)
tree indx_before_incr, indx_after_incr, cond_stmt, cond; tree indx_before_incr, indx_after_incr, cond_stmt, cond;
tree orig_cond; tree orig_cond;
edge exit_edge = loop->exit_edges[0]; edge exit_edge = loop->exit_edges[0];
block_stmt_iterator loop_exit_bsi = bsi_last (exit_edge->src); block_stmt_iterator loop_cond_bsi;
block_stmt_iterator incr_bsi;
bool insert_after;
tree begin_label = tree_block_label (loop->latch); tree begin_label = tree_block_label (loop->latch);
tree exit_label = tree_block_label (loop->single_exit->dest); tree exit_label = tree_block_label (loop->single_exit->dest);
tree init = build_int_cst (TREE_TYPE (niters), 0); tree init = build_int_cst (TREE_TYPE (niters), 0);
tree step = build_int_cst (TREE_TYPE (niters), 1); tree step = build_int_cst (TREE_TYPE (niters), 1);
tree then_label; tree then_label;
tree else_label; tree else_label;
tree incr;
orig_cond = get_loop_exit_condition (loop); orig_cond = get_loop_exit_condition (loop);
#ifdef ENABLE_CHECKING
gcc_assert (orig_cond); gcc_assert (orig_cond);
#endif
loop_cond_bsi = bsi_for_stmt (orig_cond);
standard_iv_increment_position (loop, &incr_bsi, &insert_after);
create_iv (init, step, NULL_TREE, loop, create_iv (init, step, NULL_TREE, loop,
&loop_exit_bsi, false, &indx_before_incr, &indx_after_incr); &incr_bsi, insert_after, &indx_before_incr, &indx_after_incr);
incr = bsi_stmt (incr_bsi);
/* CREATE_IV uses BSI_INSERT with TSI_NEW_STMT, so we want to get get_stmt_operands (incr);
back to the exit condition statement. */ set_stmt_info (stmt_ann (incr), new_stmt_vec_info (incr, loop));
bsi_next (&loop_exit_bsi);
gcc_assert (bsi_stmt (loop_exit_bsi) == orig_cond);
if (exit_edge->flags & EDGE_TRUE_VALUE) /* 'then' edge exits the loop. */ if (exit_edge->flags & EDGE_TRUE_VALUE) /* 'then' edge exits the loop. */
{ {
...@@ -690,10 +695,10 @@ slpeel_make_loop_iterate_ntimes (struct loop *loop, tree niters) ...@@ -690,10 +695,10 @@ slpeel_make_loop_iterate_ntimes (struct loop *loop, tree niters)
cond_stmt = build3 (COND_EXPR, TREE_TYPE (orig_cond), cond, cond_stmt = build3 (COND_EXPR, TREE_TYPE (orig_cond), cond,
then_label, else_label); then_label, else_label);
bsi_insert_before (&loop_exit_bsi, cond_stmt, BSI_SAME_STMT); bsi_insert_before (&loop_cond_bsi, cond_stmt, BSI_SAME_STMT);
/* Remove old loop exit test: */ /* Remove old loop exit test: */
bsi_remove (&loop_exit_bsi); bsi_remove (&loop_cond_bsi);
if (vect_debug_stats (loop) || vect_debug_details (loop)) if (vect_debug_stats (loop) || vect_debug_details (loop))
print_generic_expr (dump_file, cond_stmt, TDF_SLIM); print_generic_expr (dump_file, cond_stmt, TDF_SLIM);
...@@ -1847,10 +1852,13 @@ vect_get_new_vect_var (tree type, enum vect_var_kind var_kind, const char *name) ...@@ -1847,10 +1852,13 @@ vect_get_new_vect_var (tree type, enum vect_var_kind var_kind, const char *name)
just before the conditional expression that ends the single block loop. */ just before the conditional expression that ends the single block loop. */
static tree static tree
vect_create_index_for_vector_ref (struct loop *loop, block_stmt_iterator *bsi) vect_create_index_for_vector_ref (struct loop *loop)
{ {
tree init, step; tree init, step;
block_stmt_iterator incr_bsi;
bool insert_after;
tree indx_before_incr, indx_after_incr; tree indx_before_incr, indx_after_incr;
tree incr;
/* It is assumed that the base pointer used for vectorized access contains /* It is assumed that the base pointer used for vectorized access contains
the address of the first vector. Therefore the index used for vectorized the address of the first vector. Therefore the index used for vectorized
...@@ -1859,9 +1867,12 @@ vect_create_index_for_vector_ref (struct loop *loop, block_stmt_iterator *bsi) ...@@ -1859,9 +1867,12 @@ vect_create_index_for_vector_ref (struct loop *loop, block_stmt_iterator *bsi)
init = integer_zero_node; init = integer_zero_node;
step = integer_one_node; step = integer_one_node;
/* Assuming that bsi_insert is used with BSI_NEW_STMT */ standard_iv_increment_position (loop, &incr_bsi, &insert_after);
create_iv (init, step, NULL_TREE, loop, bsi, false, create_iv (init, step, NULL_TREE, loop, &incr_bsi, insert_after,
&indx_before_incr, &indx_after_incr); &indx_before_incr, &indx_after_incr);
incr = bsi_stmt (incr_bsi);
get_stmt_operands (incr);
set_stmt_info (stmt_ann (incr), new_stmt_vec_info (incr, loop));
return indx_before_incr; return indx_before_incr;
} }
...@@ -2196,7 +2207,7 @@ vect_create_data_ref_ptr (tree stmt, block_stmt_iterator *bsi, tree offset, ...@@ -2196,7 +2207,7 @@ vect_create_data_ref_ptr (tree stmt, block_stmt_iterator *bsi, tree offset,
if (only_init) /* No update in loop is required. */ if (only_init) /* No update in loop is required. */
return vect_ptr_init; return vect_ptr_init;
idx = vect_create_index_for_vector_ref (loop, bsi); idx = vect_create_index_for_vector_ref (loop);
/* Create: update = idx * vectype_size */ /* Create: update = idx * vectype_size */
tmp = create_tmp_var (integer_type_node, "update"); tmp = create_tmp_var (integer_type_node, "update");
...@@ -2440,15 +2451,16 @@ vect_finish_stmt_generation (tree stmt, tree vec_stmt, block_stmt_iterator *bsi) ...@@ -2440,15 +2451,16 @@ vect_finish_stmt_generation (tree stmt, tree vec_stmt, block_stmt_iterator *bsi)
print_generic_expr (dump_file, vec_stmt, TDF_SLIM); print_generic_expr (dump_file, vec_stmt, TDF_SLIM);
} }
#ifdef ENABLE_CHECKING
/* Make sure bsi points to the stmt that is being vectorized. */ /* Make sure bsi points to the stmt that is being vectorized. */
/* Assumption: any stmts created for the vectorization of stmt S were
inserted before S. BSI is expected to point to S or some new stmt before S.
*/
while (stmt != bsi_stmt (*bsi) && !bsi_end_p (*bsi))
bsi_next (bsi);
gcc_assert (stmt == bsi_stmt (*bsi)); gcc_assert (stmt == bsi_stmt (*bsi));
#endif
#ifdef USE_MAPPED_LOCATION
SET_EXPR_LOCATION (vec_stmt, EXPR_LOCUS (stmt));
#else
SET_EXPR_LOCUS (vec_stmt, EXPR_LOCUS (stmt));
#endif
} }
...@@ -5143,17 +5155,36 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo) ...@@ -5143,17 +5155,36 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
int j; int j;
use_optype use_ops; use_optype use_ops;
stmt_vec_info stmt_info; stmt_vec_info stmt_info;
basic_block bb;
tree phi;
if (vect_debug_details (NULL)) if (vect_debug_details (NULL))
fprintf (dump_file, "\n<<vect_mark_stmts_to_be_vectorized>>\n"); fprintf (dump_file, "\n<<vect_mark_stmts_to_be_vectorized>>\n");
bb = loop->header;
for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
{
if (vect_debug_details (NULL))
{
fprintf (dump_file, "init: phi relevant? ");
print_generic_expr (dump_file, phi, TDF_SLIM);
}
if (vect_stmt_relevant_p (phi, loop_vinfo))
{
if (vect_debug_details (NULL))
fprintf (dump_file, "unsupported reduction/induction.");
return false;
}
}
VARRAY_TREE_INIT (worklist, 64, "work list"); VARRAY_TREE_INIT (worklist, 64, "work list");
/* 1. Init worklist. */ /* 1. Init worklist. */
for (i = 0; i < nbbs; i++) for (i = 0; i < nbbs; i++)
{ {
basic_block bb = bbs[i]; bb = bbs[i];
for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si)) for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
{ {
stmt = bsi_stmt (si); stmt = bsi_stmt (si);
......
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