aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJim Wilson <wilson@cygnus.com>2000-05-03 20:04:31 +0000
committerJim Wilson <wilson@gcc.gnu.org>2000-05-03 13:04:31 -0700
commit13393c8ae70d36e71a02f61567445dc22416e3ec (patch)
tree98f5994c9c6410ae2b14149cef3af251e632acad /gcc/fold-const.c
parent8ae7150163f272acbb54b8204e2c7ff17a756417 (diff)
downloadgcc-13393c8ae70d36e71a02f61567445dc22416e3ec.zip
gcc-13393c8ae70d36e71a02f61567445dc22416e3ec.tar.gz
gcc-13393c8ae70d36e71a02f61567445dc22416e3ec.tar.bz2
Fix for ia64-linux misoptimization.
* fold-const.c (extract_muldiv, case MAX_EXPR): Don't allow signedness change. From-SVN: r33643
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e0d0f00..9568287 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -4402,6 +4402,11 @@ extract_muldiv (t, c, code, wide_type)
break;
case MIN_EXPR: case MAX_EXPR:
+ /* If widening the type changes the signedness, then we can't perform
+ this optimization as that changes the result. */
+ if (ctype != type && TREE_UNSIGNED (ctype) != TREE_UNSIGNED (type))
+ break;
+
/* MIN (a, b) / 5 -> MIN (a / 5, b / 5) */
if ((t1 = extract_muldiv (op0, c, code, wide_type)) != 0
&& (t2 = extract_muldiv (op1, c, code, wide_type)) != 0)