diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-27 08:50:15 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-27 08:50:15 +0000 |
commit | e431757faecd0f1be80bdaf3650d2fa186902884 (patch) | |
tree | ff81de6be32fc6460422dd34d41098afb88436d2 /gcc/tree-vect-loop.c | |
parent | 177650ded5bb5e38195b7557ded3c3f3d9a4327c (diff) | |
download | gcc-e431757faecd0f1be80bdaf3650d2fa186902884.tar.gz |
2013-11-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/59288
* tree-vect-loop.c (get_initial_def_for_induction): Do not
re-analyze the PHI but use STMT_VINFO_LOOP_PHI_EVOLUTION_PART.
* gcc.dg/torture/pr59288.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205434 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index c91c2e1b427..50c9d9caa34 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -3199,7 +3199,6 @@ get_initial_def_for_induction (gimple iv_phi) struct loop *iv_loop; basic_block new_bb; tree new_vec, vec_init, vec_step, t; - tree access_fn; tree new_var; tree new_name; gimple init_stmt, induction_phi, new_stmt; @@ -3207,7 +3206,6 @@ get_initial_def_for_induction (gimple iv_phi) tree init_expr, step_expr; int vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo); int i; - bool ok; int ncopies; tree expr; stmt_vec_info phi_info = vinfo_for_stmt (iv_phi); @@ -3236,13 +3234,12 @@ get_initial_def_for_induction (gimple iv_phi) latch_e = loop_latch_edge (iv_loop); loop_arg = PHI_ARG_DEF_FROM_EDGE (iv_phi, latch_e); - access_fn = analyze_scalar_evolution (iv_loop, PHI_RESULT (iv_phi)); - gcc_assert (access_fn); - STRIP_NOPS (access_fn); - ok = vect_is_simple_iv_evolution (iv_loop->num, access_fn, - &init_expr, &step_expr); - gcc_assert (ok); + step_expr = STMT_VINFO_LOOP_PHI_EVOLUTION_PART (phi_info); + gcc_assert (step_expr != NULL_TREE); + pe = loop_preheader_edge (iv_loop); + init_expr = PHI_ARG_DEF_FROM_EDGE (iv_phi, + loop_preheader_edge (iv_loop)); vectype = get_vectype_for_scalar_type (TREE_TYPE (init_expr)); resvectype = get_vectype_for_scalar_type (TREE_TYPE (PHI_RESULT (iv_phi))); @@ -3253,6 +3250,16 @@ get_initial_def_for_induction (gimple iv_phi) gcc_assert (phi_info); gcc_assert (ncopies >= 1); + /* Convert the step to the desired type. */ + step_expr = force_gimple_operand (fold_convert (TREE_TYPE (vectype), + step_expr), + &stmts, true, NULL_TREE); + if (stmts) + { + new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts); + gcc_assert (!new_bb); + } + /* Find the first insertion point in the BB. */ si = gsi_after_labels (bb); @@ -3262,9 +3269,7 @@ get_initial_def_for_induction (gimple iv_phi) /* iv_loop is nested in the loop to be vectorized. init_expr had already been created during vectorization of previous stmts. We obtain it from the STMT_VINFO_VEC_STMT of the defining stmt. */ - tree iv_def = PHI_ARG_DEF_FROM_EDGE (iv_phi, - loop_preheader_edge (iv_loop)); - vec_init = vect_get_vec_def_for_operand (iv_def, iv_phi, NULL); + vec_init = vect_get_vec_def_for_operand (init_expr, iv_phi, NULL); /* If the initial value is not of proper type, convert it. */ if (!useless_type_conversion_p (vectype, TREE_TYPE (vec_init))) { |