From 2a6e95ba024117903e4ed38512d19aea58520d2b Mon Sep 17 00:00:00 2001 From: dorit Date: Tue, 6 Feb 2007 10:08:51 +0000 Subject: 2007-02-06 Dorit Nuzman Victor Kaplansky * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121643 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-vectorizer.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'gcc/tree-vectorizer.c') diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 870163df754..9f64f2c18b7 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; -- cgit v1.2.3