From: rguenth Date: Wed, 29 Apr 2009 08:10:15 +0000 (+0000) Subject: 2009-04-28 Richard Guenther X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=f1a47479a7b91489f8107ae9e79b30a8e0f23258;hp=c2d2eaaa0ba3e938299dcd98be98b441c53994d1 2009-04-28 Richard Guenther * tree-vect-loop.c (get_initial_def_for_induction): Use correct types for pointer increment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146927 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aa0aaea9b4f..1c33bf9982d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2009-04-28 Richard Guenther + + * tree-vect-loop.c (get_initial_def_for_induction): Use + correct types for pointer increment. + 2009-04-29 Kaveh R. Ghazi * toplev.c (print_version): Update GMP version string calculation. diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index a7c6caef0a7..6c239dbf6e9 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -2223,6 +2223,7 @@ get_initial_def_for_induction (gimple iv_phi) tree loop_arg; gimple_stmt_iterator si; basic_block bb = gimple_bb (iv_phi); + tree stepvectype; vectype = get_vectype_for_scalar_type (scalar_type); gcc_assert (vectype); @@ -2235,8 +2236,10 @@ get_initial_def_for_induction (gimple iv_phi) /* Find the first insertion point in the BB. */ si = gsi_after_labels (bb); - if (INTEGRAL_TYPE_P (scalar_type) || POINTER_TYPE_P (scalar_type)) + if (INTEGRAL_TYPE_P (scalar_type)) step_expr = build_int_cst (scalar_type, 0); + else if (POINTER_TYPE_P (scalar_type)) + step_expr = build_int_cst (sizetype, 0); else step_expr = build_real (scalar_type, dconst0); @@ -2320,16 +2323,19 @@ get_initial_def_for_induction (gimple iv_phi) { /* iv_loop is the loop to be vectorized. Generate: vec_step = [VF*S, VF*S, VF*S, VF*S] */ - expr = build_int_cst (scalar_type, vf); - new_name = fold_build2 (MULT_EXPR, scalar_type, expr, step_expr); + expr = build_int_cst (TREE_TYPE (step_expr), vf); + new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr), + expr, step_expr); } t = NULL_TREE; for (i = 0; i < nunits; i++) t = tree_cons (NULL_TREE, unshare_expr (new_name), t); gcc_assert (CONSTANT_CLASS_P (new_name)); - vec = build_vector (vectype, t); - vec_step = vect_init_vector (iv_phi, vec, vectype, NULL); + stepvectype = get_vectype_for_scalar_type (TREE_TYPE (new_name)); + gcc_assert (stepvectype); + vec = build_vector (stepvectype, t); + vec_step = vect_init_vector (iv_phi, vec, stepvectype, NULL); /* Create the following def-use cycle: @@ -2377,14 +2383,15 @@ get_initial_def_for_induction (gimple iv_phi) gcc_assert (!nested_in_vect_loop); /* Create the vector that holds the step of the induction. */ - expr = build_int_cst (scalar_type, nunits); - new_name = fold_build2 (MULT_EXPR, scalar_type, expr, step_expr); + expr = build_int_cst (TREE_TYPE (step_expr), nunits); + new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr), + expr, step_expr); t = NULL_TREE; for (i = 0; i < nunits; i++) t = tree_cons (NULL_TREE, unshare_expr (new_name), t); gcc_assert (CONSTANT_CLASS_P (new_name)); - vec = build_vector (vectype, t); - vec_step = vect_init_vector (iv_phi, vec, vectype, NULL); + vec = build_vector (stepvectype, t); + vec_step = vect_init_vector (iv_phi, vec, stepvectype, NULL); vec_def = induc_def; prev_stmt_vinfo = vinfo_for_stmt (induction_phi);