diff options
author | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-11 16:45:47 +0000 |
---|---|---|
committer | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-11 16:45:47 +0000 |
commit | 8fb896c49625e0ecb551d4e4092ac1ca2fcf35c5 (patch) | |
tree | d28be87d38025ece5bfa679e0b51142c941bd476 /gcc/tree-data-ref.c | |
parent | c227f8def1ec1ff3dba7bc6459029e97da4885af (diff) | |
download | gcc-8fb896c49625e0ecb551d4e4092ac1ca2fcf35c5.tar.gz |
* tree-data-ref.c (add_multivariate_self_dist): Force the distance
vector to be positive.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123720 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r-- | gcc/tree-data-ref.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 3f24c6a5147..7d8074679ea 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -3857,6 +3857,7 @@ add_multivariate_self_dist (struct data_dependence_relation *ddr, tree c_2) tree c_1 = CHREC_LEFT (c_2); tree c_0 = CHREC_LEFT (c_1); lambda_vector dist_v; + int v1, v2, cd; /* Polynomials with more than 2 variables are not handled yet. */ if (TREE_CODE (c_0) != INTEGER_CST) @@ -3870,8 +3871,20 @@ 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)); - dist_v[x_1] = int_cst_value (CHREC_RIGHT (c_2)); - dist_v[x_2] = -int_cst_value (CHREC_RIGHT (c_1)); + v1 = int_cst_value (CHREC_RIGHT (c_1)); + v2 = int_cst_value (CHREC_RIGHT (c_2)); + cd = gcd (v1, v2); + v1 /= cd; + v2 /= cd; + + if (v2 < 0) + { + v2 = -v2; + v1 = -v1; + } + + dist_v[x_1] = v2; + dist_v[x_2] = -v1; save_dist_v (ddr, dist_v); add_outer_distances (ddr, dist_v, x_1); |