aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-10-06 07:03:51 +0000
committerRichard Biener <rguenther@suse.de>2017-10-06 07:03:51 +0000
commit27a10c3f3f166db2dfd1a604f753985f880e11c0 (patch)
treef24b47325d1cd7fdb4e31d19dc6b67267517b617 /gcc
parentcfd399a7515abd830d2cf3cd124e460e5ae03542 (diff)
2017-10-06 Richard Biener <rguenther@suse.de>
* graphite-sese-to-poly.c (extract_affine): For casts increasing precision do not perform modulo reduction. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@253474 138bc75d-0d04-0410-961f-82ee72b054a4
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 06aaa06f75d..54ba096a161 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 8611e86cc60..6cd5bc7c9d9 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);