aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorIra Rosen <ira.rosen@linaro.org>2011-06-15 06:27:32 +0000
committerIra Rosen <irar@gcc.gnu.org>2011-06-15 06:27:32 +0000
commit9d5e7640c335a590cec4497fa64230f0b0e83465 (patch)
tree907668cbb2e8294a111bd06a50c65091ce15c360 /gcc/tree-vect-loop.c
parentb273cdb17474d4d221fda93c6c9936bfd7d0a6ae (diff)
downloadgcc-9d5e7640c335a590cec4497fa64230f0b0e83465.zip
gcc-9d5e7640c335a590cec4497fa64230f0b0e83465.tar.gz
gcc-9d5e7640c335a590cec4497fa64230f0b0e83465.tar.bz2
tree-vect-loop-manip.c (remove_dead_stmts_from_loop): Remove.
* tree-vect-loop-manip.c (remove_dead_stmts_from_loop): Remove. (slpeel_tree_peel_loop_to_edge): Don't call remove_dead_stmts_from_loop. * tree-vect-loop.c (vect_determine_vectorization_factor): Don't remove irrelevant pattern statements. For irrelevant statements check if it is the last statement of a detected pattern, use corresponding pattern statement instead. (destroy_loop_vec_info): No need to remove pattern statements, only free stmt_vec_info. (vect_transform_loop): For irrelevant statements check if it is the last statement of a detected pattern, use corresponding pattern statement instead. * tree-vect-patterns.c (vect_pattern_recog_1): Don't insert pattern statements. Set basic block for the new statement. (vect_pattern_recog): Update documentation. * tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized): Scan operands of pattern statements. (vectorizable_call): Fix printing. In case of a pattern statement use the lhs of the original statement when creating a dummy statement to replace the original call. (vect_analyze_stmt): For irrelevant statements check if it is the last statement of a detected pattern, use corresponding pattern statement instead. * tree-vect-slp.c (vect_schedule_slp_instance): For pattern statements use gsi of the original statement. From-SVN: r175074
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c77
1 files changed, 43 insertions, 34 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index dd6cafe..9217bc7 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -244,7 +244,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
tree vf_vectype;
- gimple stmt = gsi_stmt (si);
+ gimple stmt = gsi_stmt (si), pattern_stmt;
stmt_info = vinfo_for_stmt (stmt);
if (vect_print_dump_info (REPORT_DETAILS))
@@ -258,20 +258,26 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
/* Skip stmts which do not need to be vectorized. */
if (!STMT_VINFO_RELEVANT_P (stmt_info)
&& !STMT_VINFO_LIVE_P (stmt_info))
- {
- if (is_pattern_stmt_p (stmt_info))
+ {
+ if (STMT_VINFO_IN_PATTERN_P (stmt_info)
+ && (pattern_stmt = STMT_VINFO_RELATED_STMT (stmt_info))
+ && (STMT_VINFO_RELEVANT_P (vinfo_for_stmt (pattern_stmt))
+ || STMT_VINFO_LIVE_P (vinfo_for_stmt (pattern_stmt))))
{
- /* We are not going to vectorize this pattern statement,
- therefore, remove it. */
- gimple_stmt_iterator tmp_gsi = gsi_for_stmt (stmt);
- STMT_VINFO_RELATED_STMT (stmt_info) = NULL;
- gsi_remove (&tmp_gsi, true);
- free_stmt_vec_info (stmt);
+ stmt = pattern_stmt;
+ stmt_info = vinfo_for_stmt (pattern_stmt);
+ if (vect_print_dump_info (REPORT_DETAILS))
+ {
+ fprintf (vect_dump, "==> examining pattern statement: ");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+ }
+ }
+ else
+ {
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "skip.");
+ continue;
}
-
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "skip.");
- continue;
}
if (gimple_get_lhs (stmt) == NULL_TREE)
@@ -828,25 +834,17 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo, bool clean_stmts)
if (stmt_info)
{
- /* Check if this is a "pattern stmt" (introduced by the
- vectorizer during the pattern recognition pass). */
- bool remove_stmt_p = false;
- gimple orig_stmt = STMT_VINFO_RELATED_STMT (stmt_info);
- if (orig_stmt)
- {
- stmt_vec_info orig_stmt_info = vinfo_for_stmt (orig_stmt);
- if (orig_stmt_info
- && STMT_VINFO_IN_PATTERN_P (orig_stmt_info))
- remove_stmt_p = true;
- }
+ /* Check if this statement has a related "pattern stmt"
+ (introduced by the vectorizer during the pattern recognition
+ pass). Free pattern's stmt_vec_info. */
+ if (STMT_VINFO_IN_PATTERN_P (stmt_info)
+ && vinfo_for_stmt (STMT_VINFO_RELATED_STMT (stmt_info)))
+ free_stmt_vec_info (STMT_VINFO_RELATED_STMT (stmt_info));
/* Free stmt_vec_info. */
free_stmt_vec_info (stmt);
-
- /* Remove dead "pattern stmts". */
- if (remove_stmt_p)
- gsi_remove (&si, true);
}
+
gsi_next (&si);
}
}
@@ -5131,7 +5129,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
for (si = gsi_start_bb (bb); !gsi_end_p (si);)
{
- gimple stmt = gsi_stmt (si);
+ gimple stmt = gsi_stmt (si), pattern_stmt;
bool is_store;
if (vect_print_dump_info (REPORT_DETAILS))
@@ -5156,14 +5154,25 @@ vect_transform_loop (loop_vec_info loop_vinfo)
if (!STMT_VINFO_RELEVANT_P (stmt_info)
&& !STMT_VINFO_LIVE_P (stmt_info))
- {
- gsi_next (&si);
- continue;
+ {
+ if (STMT_VINFO_IN_PATTERN_P (stmt_info)
+ && (pattern_stmt = STMT_VINFO_RELATED_STMT (stmt_info))
+ && (STMT_VINFO_RELEVANT_P (vinfo_for_stmt (pattern_stmt))
+ || STMT_VINFO_LIVE_P (vinfo_for_stmt (pattern_stmt))))
+ {
+ stmt = pattern_stmt;
+ stmt_info = vinfo_for_stmt (stmt);
+ }
+ else
+ {
+ gsi_next (&si);
+ continue;
+ }
}
gcc_assert (STMT_VINFO_VECTYPE (stmt_info));
- nunits =
- (unsigned int) TYPE_VECTOR_SUBPARTS (STMT_VINFO_VECTYPE (stmt_info));
+ nunits = (unsigned int) TYPE_VECTOR_SUBPARTS (
+ STMT_VINFO_VECTYPE (stmt_info));
if (!STMT_SLP_TYPE (stmt_info)
&& nunits != (unsigned int) vectorization_factor
&& vect_print_dump_info (REPORT_DETAILS))