Commit db5dc63d by Ira Rosen Committed by Dorit Nuzman

tree-vectorizer.c (vect_analyze_offset_expr): Use expr_invariant_in_loop_p.

2005-01-09  Ira Rosen  <irar@il.ibm.com>

        * tree-vectorizer.c (vect_analyze_offset_expr): Use
        expr_invariant_in_loop_p.
        Initialize outputs first thing in the function.
        (vect_update_ivs_after_vectorizer): Call initial_condition_in_loop_num.
        (vect_is_simple_iv_evolution): Call initial_condition_in_loop_num.
        (vect_analyze_pointer_ref_access): Check that the initial condition of
        the access function is loop invariant.

From-SVN: r93113
parent b927d3a4
2005-01-09 Ira Rosen <irar@il.ibm.com>
* tree-vectorizer.c (vect_analyze_offset_expr): Use
expr_invariant_in_loop_p.
Initialize outputs first thing in the function.
(vect_update_ivs_after_vectorizer): Call initial_condition_in_loop_num.
(vect_is_simple_iv_evolution): Call initial_condition_in_loop_num.
(vect_analyze_pointer_ref_access): Check that the initial condition of
the access function is loop invariant.
2005-01-09 Richard Henderson <rth@redhat.com> 2005-01-09 Richard Henderson <rth@redhat.com>
* config/i386/i386.c (bdesc_2arg): Update names for mmx_ prefixes. * config/i386/i386.c (bdesc_2arg): Update names for mmx_ prefixes.
......
...@@ -1415,17 +1415,17 @@ vect_analyze_offset_expr (tree expr, ...@@ -1415,17 +1415,17 @@ vect_analyze_offset_expr (tree expr,
tree left_step = size_zero_node; tree left_step = size_zero_node;
tree right_step = size_zero_node; tree right_step = size_zero_node;
enum tree_code code; enum tree_code code;
tree init, evolution, def_stmt; tree init, evolution;
*step = NULL_TREE;
*misalign = NULL_TREE;
*initial_offset = NULL_TREE;
/* Strip conversions that don't narrow the mode. */ /* Strip conversions that don't narrow the mode. */
expr = vect_strip_conversion (expr); expr = vect_strip_conversion (expr);
if (!expr) if (!expr)
return false; return false;
*step = NULL_TREE;
*misalign = NULL_TREE;
*initial_offset = NULL_TREE;
/* Stop conditions: /* Stop conditions:
1. Constant. */ 1. Constant. */
if (TREE_CODE (expr) == INTEGER_CST) if (TREE_CODE (expr) == INTEGER_CST)
...@@ -1447,18 +1447,12 @@ vect_analyze_offset_expr (tree expr, ...@@ -1447,18 +1447,12 @@ vect_analyze_offset_expr (tree expr,
return false; return false;
init = initial_condition_in_loop_num (access_fn, loop->num); init = initial_condition_in_loop_num (access_fn, loop->num);
if (init == expr) if (init == expr && !expr_invariant_in_loop_p (loop, init))
{ /* Not enough information: may be not loop invariant.
def_stmt = SSA_NAME_DEF_STMT (init); E.g., for a[b[i]], we get a[D], where D=b[i]. EXPR is D, its
if (def_stmt initial_condition is D, but it depends on i - loop's induction
&& !IS_EMPTY_STMT (def_stmt) variable. */
&& flow_bb_inside_loop_p (loop, bb_for_stmt (def_stmt))) return false;
/* Not enough information: may be not loop invariant.
E.g., for a[b[i]], we get a[D], where D=b[i]. EXPR is D, its
initial_condition is D, but it depends on i - loop's induction
variable. */
return false;
}
evolution = evolution_part_in_loop_num (access_fn, loop->num); evolution = evolution_part_in_loop_num (access_fn, loop->num);
if (evolution && TREE_CODE (evolution) != INTEGER_CST) if (evolution && TREE_CODE (evolution) != INTEGER_CST)
...@@ -3174,7 +3168,8 @@ vect_update_ivs_after_vectorizer (struct loop *loop, tree niters, edge update_e) ...@@ -3174,7 +3168,8 @@ vect_update_ivs_after_vectorizer (struct loop *loop, tree niters, edge update_e)
gcc_assert (!tree_is_chrec (evolution_part)); gcc_assert (!tree_is_chrec (evolution_part));
step_expr = evolution_part; step_expr = evolution_part;
init_expr = unshare_expr (initial_condition (access_fn)); init_expr = unshare_expr (initial_condition_in_loop_num (access_fn,
loop->num));
ni = build2 (PLUS_EXPR, TREE_TYPE (init_expr), ni = build2 (PLUS_EXPR, TREE_TYPE (init_expr),
build2 (MULT_EXPR, TREE_TYPE (niters), build2 (MULT_EXPR, TREE_TYPE (niters),
...@@ -3890,7 +3885,7 @@ vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init, ...@@ -3890,7 +3885,7 @@ vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init,
return false; return false;
step_expr = evolution_part; step_expr = evolution_part;
init_expr = unshare_expr (initial_condition (access_fn)); init_expr = unshare_expr (initial_condition_in_loop_num (access_fn, loop_nb));
if (vect_debug_details (NULL)) if (vect_debug_details (NULL))
{ {
...@@ -4618,6 +4613,14 @@ vect_analyze_pointer_ref_access (tree memref, tree stmt, bool is_read) ...@@ -4618,6 +4613,14 @@ vect_analyze_pointer_ref_access (tree memref, tree stmt, bool is_read)
STRIP_NOPS (init); STRIP_NOPS (init);
if (!expr_invariant_in_loop_p (loop, init))
{
if (vect_debug_stats (loop) || vect_debug_details (loop))
fprintf (dump_file,
"not vectorized: initial condition is not loop invariant.");
return NULL;
}
if (TREE_CODE (step) != INTEGER_CST) if (TREE_CODE (step) != INTEGER_CST)
{ {
if (vect_debug_stats (loop) || vect_debug_details (loop)) if (vect_debug_stats (loop) || vect_debug_details (loop))
......
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