From e1feff4f744b5c403e2e8b38ce7224320e5e6c7a Mon Sep 17 00:00:00 2001 From: spop Date: Thu, 3 Jan 2008 21:59:38 +0000 Subject: [PATCH] 2008-01-02 Sebastian Pop PR tree-optimization/34458 * tree-data-ref.c (dd_int_cst_value): New. (initialize_matrix_A, compute_overlap_steps_for_affine_1_2, analyze_subscript_affine_affine, build_classic_dist_vector_1, add_multivariate_self_dist, init_omega_eq_with_af): Use dd_int_cst_value instead of int_cst_value. * testsuite/gcc.dg/tree-ssa/pr34458.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131307 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++- gcc/testsuite/ChangeLog | 7 +++++- gcc/testsuite/gcc.dg/tree-ssa/pr34458.c | 14 ++++++++++++ gcc/tree-data-ref.c | 39 +++++++++++++++++++++------------ 4 files changed, 55 insertions(+), 16 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr34458.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 08cc05c..0364c4f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2008-01-03 Sebastian Pop + + PR tree-optimization/34458 + * tree-data-ref.c (dd_int_cst_value): New. + (initialize_matrix_A, compute_overlap_steps_for_affine_1_2, + analyze_subscript_affine_affine, build_classic_dist_vector_1, + add_multivariate_self_dist, init_omega_eq_with_af): Use + dd_int_cst_value instead of int_cst_value. + 2008-01-03 Jan Hubicka PR tree-optimization/31081 @@ -20,7 +29,7 @@ * doc/extend.texi (Labels as Values): Document &&foo behaviour vs. inlining. -2007-12-19 Sebastian Pop +2008-01-03 Sebastian Pop PR tree-optimization/34635 * tree-data-ref.c (add_other_self_distances): Make sure that the diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b2891dc..ab12caa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-01-03 Sebastian Pop + + PR tree-optimization/34458 + * gcc.dg/tree-ssa/pr34458.c: New. + 2008-01-03 Thomas Koenig PR libfortran/34565 @@ -15,7 +20,7 @@ * gcc.c-torture/execute/20071220-1.c: New test. * gcc.c-torture/execute/20071220-2.c: New test. -2007-12-19 Sebastian Pop +2008-01-03 Sebastian Pop PR tree-optimization/34635 * gcc.dg/tree-ssa/pr34635.c: New. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr34458.c b/gcc/testsuite/gcc.dg/tree-ssa/pr34458.c new file mode 100644 index 0000000..df757bf --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr34458.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +struct A +{ + int x[8]; +}; + +void foo(struct A* p, long long j) +{ + int i; + for (i = 0; i < 2; ++i) + p->x[i+j+1] = p->x[i+j]; +} diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 88f6347..5fd39f6 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -1817,6 +1817,17 @@ analyze_siv_subscript_cst_affine (tree chrec_a, } } +/* Return the HWI converted value of X. */ + +static inline HOST_WIDE_INT +dd_int_cst_value (tree x) +{ + if (TYPE_PRECISION (TREE_TYPE (x)) > HOST_BITS_PER_WIDE_INT) + x = fold_convert (integer_type_node, x); + + return int_cst_value (x); +} + /* Helper recursive function for initializing the matrix A. Returns the initial value of CHREC. */ @@ -1826,9 +1837,9 @@ initialize_matrix_A (lambda_matrix A, tree chrec, unsigned index, int mult) gcc_assert (chrec); if (TREE_CODE (chrec) != POLYNOMIAL_CHREC) - return int_cst_value (chrec); + return dd_int_cst_value (chrec); - A[index][0] = mult * int_cst_value (CHREC_RIGHT (chrec)); + A[index][0] = mult * dd_int_cst_value (CHREC_RIGHT (chrec)); return initialize_matrix_A (A, CHREC_LEFT (chrec), index + 1, mult); } @@ -1913,9 +1924,9 @@ compute_overlap_steps_for_affine_1_2 (tree chrec_a, tree chrec_b, affine_fn ova1, ova2, ovb; tree last_conflicts_xz, last_conflicts_yz, last_conflicts_xyz; - step_x = int_cst_value (CHREC_RIGHT (CHREC_LEFT (chrec_a))); - step_y = int_cst_value (CHREC_RIGHT (chrec_a)); - step_z = int_cst_value (CHREC_RIGHT (chrec_b)); + step_x = dd_int_cst_value (CHREC_RIGHT (CHREC_LEFT (chrec_a))); + step_y = dd_int_cst_value (CHREC_RIGHT (chrec_a)); + step_z = dd_int_cst_value (CHREC_RIGHT (chrec_b)); niter_x = estimated_loop_iterations_int (get_chrec_loop (CHREC_LEFT (chrec_a)), @@ -2086,8 +2097,8 @@ analyze_subscript_affine_affine (tree chrec_a, niter_b = estimated_loop_iterations_int (get_chrec_loop (chrec_b), false); niter = MIN (niter_a, niter_b); - step_a = int_cst_value (CHREC_RIGHT (chrec_a)); - step_b = int_cst_value (CHREC_RIGHT (chrec_b)); + step_a = dd_int_cst_value (CHREC_RIGHT (chrec_a)); + step_b = dd_int_cst_value (CHREC_RIGHT (chrec_b)); compute_overlap_steps_for_affine_univar (niter, step_a, step_b, &ova, &ovb, @@ -2752,7 +2763,7 @@ build_classic_dist_vector_1 (struct data_dependence_relation *ddr, return false; } - dist = int_cst_value (SUB_DISTANCE (subscript)); + dist = dd_int_cst_value (SUB_DISTANCE (subscript)); /* This is the subscript coupling test. If we have already recorded a distance for this loop (a distance coming from @@ -2847,8 +2858,8 @@ add_multivariate_self_dist (struct data_dependence_relation *ddr, tree c_2) /* For "{{0, +, 2}_1, +, 3}_2" the distance vector is (3, -2). */ dist_v = lambda_vector_new (DDR_NB_LOOPS (ddr)); - v1 = int_cst_value (CHREC_RIGHT (c_1)); - v2 = int_cst_value (CHREC_RIGHT (c_2)); + v1 = dd_int_cst_value (CHREC_RIGHT (c_1)); + v2 = dd_int_cst_value (CHREC_RIGHT (c_2)); cd = gcd (v1, v2); v1 /= cd; v2 /= cd; @@ -3275,14 +3286,14 @@ init_omega_eq_with_af (omega_pb pb, unsigned eq, return false; var_idx = index_in_loop_nest (var, DDR_LOOP_NEST (ddr)); - pb->eqs[eq].coef[offset + var_idx + 1] = int_cst_value (right); + pb->eqs[eq].coef[offset + var_idx + 1] = dd_int_cst_value (right); /* Compute the innermost loop index. */ DDR_INNER_LOOP (ddr) = MAX (DDR_INNER_LOOP (ddr), var_idx); if (offset == 0) pb->eqs[eq].coef[var_idx + DDR_NB_LOOPS (ddr) + 1] - += int_cst_value (right); + += dd_int_cst_value (right); switch (TREE_CODE (left)) { @@ -3290,7 +3301,7 @@ init_omega_eq_with_af (omega_pb pb, unsigned eq, return init_omega_eq_with_af (pb, eq, offset, left, ddr); case INTEGER_CST: - pb->eqs[eq].coef[0] += int_cst_value (left); + pb->eqs[eq].coef[0] += dd_int_cst_value (left); return true; default: @@ -3299,7 +3310,7 @@ init_omega_eq_with_af (omega_pb pb, unsigned eq, } case INTEGER_CST: - pb->eqs[eq].coef[0] += int_cst_value (access_fun); + pb->eqs[eq].coef[0] += dd_int_cst_value (access_fun); return true; default: -- 2.7.4