aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-loop-jam.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-11-23 10:11:41 +0100
committerRichard Biener <rguenther@suse.de>2021-11-23 11:04:34 +0100
commit6cd440670078af89d82cbb67e01a5ecec8eec238 (patch)
treef9fdb1da2189db498f22bc8f21bd3bcbe1375bf6 /gcc/gimple-loop-jam.c
parent2780484bc376a89edb0c97b6b85209f4c27f34ee (diff)
downloadgcc-6cd440670078af89d82cbb67e01a5ecec8eec238.zip
gcc-6cd440670078af89d82cbb67e01a5ecec8eec238.tar.gz
gcc-6cd440670078af89d82cbb67e01a5ecec8eec238.tar.bz2
tree-optimization/103361 - fix unroll-and-jam direction vector handling
This properly uses lambda_int instead of truncating the direction vector to int which leads to false unexpected negative values. 2021-11-23 Richard Biener <rguenther@suse.de> PR tree-optimization/103361 * gimple-loop-jam.c (adjust_unroll_factor): Use lambda_int for the dependence distance. * tree-data-ref.c (print_lambda_vector): Properly print a lambda_int. * g++.dg/torture/pr103361.C: New testcase.
Diffstat (limited to 'gcc/gimple-loop-jam.c')
-rw-r--r--gcc/gimple-loop-jam.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/gimple-loop-jam.c b/gcc/gimple-loop-jam.c
index 666f740..933a4e0 100644
--- a/gcc/gimple-loop-jam.c
+++ b/gcc/gimple-loop-jam.c
@@ -402,10 +402,10 @@ adjust_unroll_factor (class loop *inner, struct data_dependence_relation *ddr,
a >= N, or b > 0, or b is zero and a > 0. Otherwise the unroll
factor needs to be limited so that the first condition holds.
That may limit the factor down to zero in the worst case. */
- int dist = dist_v[0];
+ lambda_int dist = dist_v[0];
if (dist < 0)
gcc_unreachable ();
- else if ((unsigned)dist >= *unroll)
+ else if (dist >= (lambda_int)*unroll)
;
else if (lambda_vector_zerop (dist_v + 1, DDR_NB_LOOPS (ddr) - 1))
{