aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
authorDorit Nuzman <dorit@il.ibm.com>2007-02-06 10:08:51 +0000
committerDorit Nuzman <dorit@gcc.gnu.org>2007-02-06 10:08:51 +0000
commitfbf798fcc5f1a456213c99d59df41adaf38ad4d8 (patch)
tree3e78c2931f5a1e916ecd248c65d21ec69fd56509 /gcc/tree-vectorizer.c
parent426147a1e8ca92e3c32168f50dc9a2d04825c42c (diff)
downloadgcc-fbf798fcc5f1a456213c99d59df41adaf38ad4d8.zip
gcc-fbf798fcc5f1a456213c99d59df41adaf38ad4d8.tar.gz
gcc-fbf798fcc5f1a456213c99d59df41adaf38ad4d8.tar.bz2
tree-vectorizer.c (vect_is_simple_use): Support induction.
2007-02-06 Dorit Nuzman <dorit@il.ibm.com> Victor Kaplansky <victork@il.ibm.com> * tree-vectorizer.c (vect_is_simple_use): Support induction. (vect_is_simple_reduction): Support reduction with induction as one of the operands. (vect_is_simple_iv_evolution): Fix formatting. * tree-vect-analyze.c (vect_mark_stmts_to_be_vectorized): Fix formatting. Don't mark induction phis for vectorization. (vect_analyze_scalar_cycles): Analyze all inductions, then reductions. * tree-vect-transform.c (get_initial_def_for_induction): New function. (vect_get_vec_def_for_operand): Support induction. (vect_get_vec_def_for_stmt_copy): Fix formatting and add check for induction case. (vectorizable_reduction): Support reduction with induction as one of the operands. (vectorizable_type_demotion): Use def-type of stmt argument rather than dummy def-type. * tree-ssa-loop.c (gate_scev_const_prop): Return the value of flag_tree_scev_cprop. * common.opt (tree-scev-cprop): New flag. * tree-vect-transform.c (vect_create_destination_var): Use 'kind' in call to vect_get_new_vect_var. Co-Authored-By: Victor Kaplansky <victork@il.ibm.com> From-SVN: r121643
Diffstat (limited to 'gcc/tree-vectorizer.c')
-rw-r--r--gcc/tree-vectorizer.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 870163d..9f64f2c 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -1745,13 +1745,6 @@ vect_is_simple_use (tree operand, loop_vec_info loop_vinfo, tree *def_stmt,
return false;
}
- if (*dt == vect_induction_def)
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "induction not supported.");
- return false;
- }
-
return true;
}
@@ -2050,7 +2043,7 @@ vect_is_simple_reduction (struct loop *loop, tree phi)
*/
def1 = SSA_NAME_DEF_STMT (op1);
def2 = SSA_NAME_DEF_STMT (op2);
- if (!def1 || !def2)
+ if (!def1 || !def2 || IS_EMPTY_STMT (def1) || IS_EMPTY_STMT (def2))
{
if (vect_print_dump_info (REPORT_DETAILS))
{
@@ -2060,9 +2053,15 @@ vect_is_simple_reduction (struct loop *loop, tree phi)
return NULL_TREE;
}
- if (TREE_CODE (def1) == GIMPLE_MODIFY_STMT
+
+ /* Check that one def is the reduction def, defined by PHI,
+ the other def is either defined in the loop by a GIMPLE_MODIFY_STMT,
+ or it's an induction (defined by some phi node). */
+
+ if (def2 == phi
&& flow_bb_inside_loop_p (loop, bb_for_stmt (def1))
- && def2 == phi)
+ && (TREE_CODE (def1) == GIMPLE_MODIFY_STMT
+ || STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def1)) == vect_induction_def))
{
if (vect_print_dump_info (REPORT_DETAILS))
{
@@ -2071,9 +2070,10 @@ vect_is_simple_reduction (struct loop *loop, tree phi)
}
return def_stmt;
}
- else if (TREE_CODE (def2) == GIMPLE_MODIFY_STMT
- && flow_bb_inside_loop_p (loop, bb_for_stmt (def2))
- && def1 == phi)
+ else if (def1 == phi
+ && flow_bb_inside_loop_p (loop, bb_for_stmt (def2))
+ && (TREE_CODE (def2) == GIMPLE_MODIFY_STMT
+ || STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def2)) == vect_induction_def))
{
/* Swap operands (just for simplicity - so that the rest of the code
can assume that the reduction variable is always the last (second)
@@ -2110,7 +2110,6 @@ vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init,
{
tree init_expr;
tree step_expr;
-
tree evolution_part = evolution_part_in_loop_num (access_fn, loop_nb);
/* When there is no evolution in this loop, the evolution function
@@ -2124,8 +2123,7 @@ vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init,
return false;
step_expr = evolution_part;
- init_expr = unshare_expr (initial_condition_in_loop_num (access_fn,
- loop_nb));
+ init_expr = unshare_expr (initial_condition_in_loop_num (access_fn, loop_nb));
if (vect_print_dump_info (REPORT_DETAILS))
{
@@ -2139,7 +2137,7 @@ vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init,
*step = step_expr;
if (TREE_CODE (step_expr) != INTEGER_CST)
- {
+ {
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "step unknown.");
return false;