aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-transform.c
diff options
context:
space:
mode:
authorIra Rosen <irar@il.ibm.com>2008-09-22 07:55:39 +0000
committerIra Rosen <irar@gcc.gnu.org>2008-09-22 07:55:39 +0000
commit5e038cad0bb468177c7adad1faebf3465ecda0fd (patch)
tree083ed4affd0a185e5e877ef640693c7f6195fbb4 /gcc/tree-vect-transform.c
parentc801c273a6b8080f3fce824b3872fae899385618 (diff)
downloadgcc-5e038cad0bb468177c7adad1faebf3465ecda0fd.zip
gcc-5e038cad0bb468177c7adad1faebf3465ecda0fd.tar.gz
gcc-5e038cad0bb468177c7adad1faebf3465ecda0fd.tar.bz2
re PR tree-optimization/37482 (definition in block 51 follows the use for SSA_NAME with -maltivec)
PR tree-optimization/37482 * tree-vectorizer.h (struct _slp_instance): Add new field. (SLP_INSTANCE_FIRST_LOAD_STMT): New. (get_earlier_stmt): New function. * tree-vect-analyze.c (vect_find_first_load_in_slp_instance): New function. (vect_analyze_slp_instance): Set SLP_INSTANCE_FIRST_LOAD_STMT. * tree-vect-transform.c (vect_finish_stmt_generation): Remove the asserts that GSI points to the scalar statement being vectorized. Set new statement location according to GSI. (vect_schedule_slp_instance): Use GSI of SLP_INSTANCE_FIRST_LOAD_STMT when vectorizing loads. From-SVN: r140544
Diffstat (limited to 'gcc/tree-vect-transform.c')
-rw-r--r--gcc/tree-vect-transform.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c
index 4965da4..d004aad 100644
--- a/gcc/tree-vect-transform.c
+++ b/gcc/tree-vect-transform.c
@@ -2155,7 +2155,6 @@ vect_finish_stmt_generation (gimple stmt, gimple vec_stmt,
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
- gcc_assert (stmt == gsi_stmt (*gsi));
gcc_assert (gimple_code (stmt) != GIMPLE_LABEL);
gsi_insert_before (gsi, vec_stmt, GSI_SAME_STMT);
@@ -2168,10 +2167,7 @@ vect_finish_stmt_generation (gimple stmt, gimple vec_stmt,
print_gimple_stmt (vect_dump, vec_stmt, 0, TDF_SLIM);
}
- /* Make sure gsi points to the stmt that is being vectorized. */
- gcc_assert (stmt == gsi_stmt (*gsi));
-
- gimple_set_location (vec_stmt, gimple_location (stmt));
+ gimple_set_location (vec_stmt, gimple_location (gsi_stmt (*gsi)));
}
@@ -8156,7 +8152,7 @@ vect_remove_stores (gimple first_stmt)
static bool
vect_schedule_slp_instance (slp_tree node, slp_instance instance,
- unsigned int vectorization_factor)
+ unsigned int vectorization_factor)
{
gimple stmt;
bool strided_store, is_store;
@@ -8177,6 +8173,7 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance,
stmt = VEC_index (gimple, SLP_TREE_SCALAR_STMTS (node), 0);
stmt_info = vinfo_for_stmt (stmt);
+
/* VECTYPE is the type of the destination. */
vectype = get_vectype_for_scalar_type (TREE_TYPE (gimple_assign_lhs (stmt)));
nunits = (unsigned int) TYPE_VECTOR_SUBPARTS (vectype);
@@ -8218,7 +8215,14 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance,
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- si = gsi_for_stmt (stmt);
+ /* Loads should be inserted before the first load. */
+ if (SLP_INSTANCE_FIRST_LOAD_STMT (instance)
+ && STMT_VINFO_STRIDED_ACCESS (stmt_info)
+ && !REFERENCE_CLASS_P (gimple_get_lhs (stmt)))
+ si = gsi_for_stmt (SLP_INSTANCE_FIRST_LOAD_STMT (instance));
+ else
+ si = gsi_for_stmt (stmt);
+
is_store = vect_transform_stmt (stmt, &si, &strided_store, node, instance);
if (is_store)
{
@@ -8252,8 +8256,7 @@ vect_schedule_slp (loop_vec_info loop_vinfo)
{
/* Schedule the tree of INSTANCE. */
is_store = vect_schedule_slp_instance (SLP_INSTANCE_TREE (instance),
- instance,
- LOOP_VINFO_VECT_FACTOR (loop_vinfo));
+ instance, LOOP_VINFO_VECT_FACTOR (loop_vinfo));
if (vect_print_dump_info (REPORT_VECTORIZED_LOOPS)
|| vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))