diff options
| author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-12 00:13:06 +0000 |
|---|---|---|
| committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-12 00:13:06 +0000 |
| commit | 3e8124eacbeac87e8761e00db4d98de1f7d692ac (patch) | |
| tree | cedabec28787948d73190a83bfd0ca0b29d95d61 /gcc/tree-data-ref.c | |
| parent | 4c016128fa73078477dd2c4a2d5c631cf1c98551 (diff) | |
| download | ppe42-gcc-3e8124eacbeac87e8761e00db4d98de1f7d692ac.tar.gz ppe42-gcc-3e8124eacbeac87e8761e00db4d98de1f7d692ac.zip | |
* tree-data-ref.c (analyze_subscript_affine_affine): Correctly
compute the first overlapping iterations.
PR middle-end/18005
* tree-data-ref.c (estimate_niter_from_size_of_data): Ensure
that arguments of EXACT_DIV_EXPR are INTEGER_CST.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90510 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-data-ref.c')
| -rw-r--r-- | gcc/tree-data-ref.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 3c883465076..718059fffd8 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -513,11 +513,12 @@ estimate_niter_from_size_of_data (struct loop *loop, array_size = TYPE_SIZE (TREE_TYPE (opnd0)); element_size = TYPE_SIZE (TREE_TYPE (TREE_TYPE (opnd0))); if (array_size == NULL_TREE - || element_size == NULL_TREE) + || TREE_CODE (array_size) != INTEGER_CST + || TREE_CODE (element_size) != INTEGER_CST) return; data_size = fold (build2 (EXACT_DIV_EXPR, integer_type_node, - array_size, element_size)); + array_size, element_size)); if (init != NULL_TREE && step != NULL_TREE @@ -1435,12 +1436,21 @@ analyze_subscript_affine_affine (tree chrec_a, if (j1 > 0) { - int last_conflict; + int last_conflict, min_multiple; tau1 = MAX (tau1, CEIL (-j0, j1)); tau2 = MIN (tau2, FLOOR_DIV (niter - j0, j1)); - x0 = (i1 * tau1 + i0) % i1; - y0 = (j1 * tau1 + j0) % j1; + x0 = i1 * tau1 + i0; + y0 = j1 * tau1 + j0; + + /* At this point (x0, y0) is one of the + solutions to the Diophantine equation. The + next step has to compute the smallest + positive solution: the first conflicts. */ + min_multiple = MIN (x0 / i1, y0 / j1); + x0 -= i1 * min_multiple; + y0 -= j1 * min_multiple; + tau1 = (x0 - i0)/i1; last_conflict = tau2 - tau1; |

