From bfe20447cb8ed0643e71f42a4277b643ed1f952f Mon Sep 17 00:00:00 2001 From: spop Date: Thu, 3 Jan 2008 02:38:24 +0000 Subject: [PATCH] 2007-12-19 Sebastian Pop PR tree-optimization/34635 * tree-data-ref.c (add_other_self_distances): Make sure that the evolution step is constant. * gcc.dg/tree-ssa/pr34635.c: New. * gcc.dg/tree-ssa/pr34635-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131275 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/tree-ssa/pr34635-1.c | 14 ++++++++++++++ gcc/testsuite/gcc.dg/tree-ssa/pr34635.c | 14 ++++++++++++++ gcc/tree-data-ref.c | 16 +++++++++++++--- 5 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr34635-1.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr34635.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f08d3af6ade..f5516e75f4c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-12-19 Sebastian Pop + + PR tree-optimization/34635 + * tree-data-ref.c (add_other_self_distances): Make sure that the + evolution step is constant. + 2008-01-03 Jakub Jelinek PR middle-end/34608 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c00eb633ae..ff42813f96b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2007-12-19 Sebastian Pop + + PR tree-optimization/34635 + * gcc.dg/tree-ssa/pr34635.c: New. + * gcc.dg/tree-ssa/pr34635-1.c: New. + 2008-01-02 John David Anglin PR middle-end/34562 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr34635-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr34635-1.c new file mode 100644 index 00000000000..5afc6db2726 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr34635-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +void foo(int x[]) +{ + int i, j; + + for (i = 0; i < 2; i++) + for (j = 0; j < 2; j++) + { + x[i] = x[i+j]; + x[i] = x[i+j]; + } +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr34635.c b/gcc/testsuite/gcc.dg/tree-ssa/pr34635.c new file mode 100644 index 00000000000..5b4253cc4f0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr34635.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +void foo(int x[]) +{ + int i, j; + + for (i = 0; i < 2; i++) + for (j = 0; j < 2; j++) + { + x[i] = x[i*j]; + x[i] = x[i*j]; + } +} diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 07b311a93fd..88f6347f777 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -2818,9 +2818,9 @@ constant_access_functions (const struct data_dependence_relation *ddr) return true; } - /* Helper function for the case where DDR_A and DDR_B are the same - multivariate access function. */ + multivariate access function with a constant step. For an example + see pr34635-1.c. */ static void add_multivariate_self_dist (struct data_dependence_relation *ddr, tree c_2) @@ -2890,7 +2890,17 @@ add_other_self_distances (struct data_dependence_relation *ddr) return; } - add_multivariate_self_dist (ddr, DR_ACCESS_FN (DDR_A (ddr), 0)); + access_fun = DR_ACCESS_FN (DDR_A (ddr), 0); + + if (TREE_CODE (CHREC_LEFT (access_fun)) == POLYNOMIAL_CHREC) + add_multivariate_self_dist (ddr, access_fun); + else + /* The evolution step is not constant: it varies in + the outer loop, so this cannot be represented by a + distance vector. For example in pr34635.c the + evolution is {0, +, {0, +, 4}_1}_2. */ + DDR_AFFINE_P (ddr) = false; + return; } -- 2.11.0