aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-10-06 07:03:51 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-10-06 07:03:51 +0000
commit57cfa172280fd4a79a1d4120b69054457100af94 (patch)
treef24b47325d1cd7fdb4e31d19dc6b67267517b617 /gcc
parent31bee964798d25ac83e513de6858b69c3a9624be (diff)
downloadgcc-57cfa172280fd4a79a1d4120b69054457100af94.zip
gcc-57cfa172280fd4a79a1d4120b69054457100af94.tar.gz
gcc-57cfa172280fd4a79a1d4120b69054457100af94.tar.bz2
graphite-sese-to-poly.c (extract_affine): For casts increasing precision do not perform modulo reduction.
2017-10-06 Richard Biener <rguenther@suse.de> * graphite-sese-to-poly.c (extract_affine): For casts increasing precision do not perform modulo reduction. From-SVN: r253474
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/graphite-sese-to-poly.c17
2 files changed, 17 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 06aaa06..54ba096 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2017-10-06 Richard Biener <rguenther@suse.de>
+ * graphite-sese-to-poly.c (extract_affine): For casts increasing
+ precision do not perform modulo reduction.
+
+2017-10-06 Richard Biener <rguenther@suse.de>
+
PR tree-optimization/82436
* tree-vect-slp.c (vect_supported_load_permutation_p): More
conservatively choose the vectorization factor when checking
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 8611e86..6cd5bc7 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -299,11 +299,18 @@ extract_affine (scop_p s, tree e, __isl_take isl_space *space)
return res;
CASE_CONVERT:
- res = extract_affine (s, TREE_OPERAND (e, 0), space);
- /* signed values, even if overflow is undefined, get modulo-reduced. */
- if (! TYPE_UNSIGNED (type))
- res = wrap (res, TYPE_PRECISION (type) - 1);
- break;
+ {
+ tree itype = TREE_TYPE (TREE_OPERAND (e, 0));
+ res = extract_affine (s, TREE_OPERAND (e, 0), space);
+ /* Signed values, even if overflow is undefined, get modulo-reduced.
+ But only if not all values of the old type fit in the new. */
+ if (! TYPE_UNSIGNED (type)
+ && ((TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (e, 0)))
+ && TYPE_PRECISION (type) <= TYPE_PRECISION (itype))
+ || TYPE_PRECISION (type) < TYPE_PRECISION (itype)))
+ res = wrap (res, TYPE_PRECISION (type) - 1);
+ break;
+ }
case NON_LVALUE_EXPR:
res = extract_affine (s, TREE_OPERAND (e, 0), space);