aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>2000-04-14 10:45:17 -0700
committerRichard Henderson <rth@gcc.gnu.org>2000-04-14 10:45:17 -0700
commit23cdce68cfdbf75b2a7fc60ccf17477260db9f68 (patch)
tree8cc9866caf0c8fef6ebbca671309cc014b1a0e80
parent6e628096889effd0046ea70a7c6910e181af7510 (diff)
downloadgcc-23cdce68cfdbf75b2a7fc60ccf17477260db9f68.zip
gcc-23cdce68cfdbf75b2a7fc60ccf17477260db9f68.tar.gz
gcc-23cdce68cfdbf75b2a7fc60ccf17477260db9f68.tar.bz2
fold-const.c (extract_muldiv): Don't distribute and widen multiply across plus for non-sizetype unsigned types.
* fold-const.c (extract_muldiv): Don't distribute and widen multiply across plus for non-sizetype unsigned types. From-SVN: r33151
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/fold-const.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4465c29..29c1d1f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2000-04-14 Richard Henderson <rth@cygnus.com>
+ * fold-const.c (extract_muldiv): Don't distribute and widen
+ multiply across plus for non-sizetype unsigned types.
+
+2000-04-14 Richard Henderson <rth@cygnus.com>
+
* flow.c (find_auto_inc): Don't autoinc eliminable registers.
If the original source is dead in the incr insn, it's dead now.
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 19b2f70..991dddd 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -4480,6 +4480,14 @@ extract_muldiv (t, c, code, wide_type)
if (op1 == 0 || TREE_OVERFLOW (op1))
break;
+ /* If we have an unsigned type is not a sizetype, we cannot widen
+ the operation since it will change the result if the original
+ computation overflowed. */
+ if (TREE_UNSIGNED (ctype)
+ && ! TYPE_IS_SIZETYPE (ctype)
+ && ctype != type)
+ break;
+
/* If we were able to eliminate our operation from the first side,
apply our operation to the second side and reform the PLUS. */
if (t1 != 0 && (TREE_CODE (t1) != code || code == MULT_EXPR))