Fix for ia64-linux misoptimization.
authorJim Wilson <wilson@cygnus.com>
Wed, 3 May 2000 20:04:31 +0000 (20:04 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Wed, 3 May 2000 20:04:31 +0000 (13:04 -0700)
* fold-const.c (extract_muldiv, case MAX_EXPR): Don't allow signedness
change.

From-SVN: r33643

gcc/ChangeLog
gcc/fold-const.c

index 96da99a3a135855858626bb6a26868cddbee7f9d..d891f18dfade06187852d39de6cea4fa6ab68967 100644 (file)
@@ -1,3 +1,8 @@
+Wed May  3 12:55:46 2000  Jim Wilson  <wilson@cygnus.com>
+
+       * fold-const.c (extract_muldiv, case MAX_EXPR): Don't allow signedness
+       change.
+
 2000-05-03  Greg McGary  <gkm@gnu.org>
 
        * tree.h (tree_common): Add bounded_flag member.  Remove
index e0d0f00cb4e347cabf9e724c739d7b4851a3ba4b..95682876252a13914ebc80cb64e6f37a9456f470 100644 (file)
@@ -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)