]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/23606 (fold does not fold (type)(a == b) into a == b (with type...
authorAndrew Pinski <pinskia@physics.uc.edu>
Tue, 22 Nov 2005 19:22:21 +0000 (19:22 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Tue, 22 Nov 2005 19:22:21 +0000 (11:22 -0800)
2005-11-22  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/23606
        * fold-const.c (fold_unary) <case NOP_EXPR, CONVERT_EXPR>: For
        COMPARISON_CLASS_P and an integral types create create a new
        expression with the new type and fold that.

From-SVN: r107370

gcc/ChangeLog
gcc/fold-const.c

index 3a81593ac53dbf551f98e381ae8b7394ed56ca96..f16711a73099969fff95b317fb07d641f27fe1da 100644 (file)
@@ -1,3 +1,10 @@
+2005-11-22  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR middle-end/23606
+       * fold-const.c (fold_unary) <case NOP_EXPR, CONVERT_EXPR>: For
+       COMPARISON_CLASS_P and an integral types create create a new
+       expression with the new type and fold that.
+
 2005-11-22  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR target/24988
index e7f550b2038ae43d815f7ab9d3dacbb0d84fd2fa..2d750f6c94c17adb4765c4be6ea34aef8ee7fddb 100644 (file)
@@ -6771,6 +6771,12 @@ fold_unary (enum tree_code code, tree type, tree op0)
     case FIX_ROUND_EXPR:
       if (TREE_TYPE (op0) == type)
        return op0;
+      
+      /* If we have (type) (a CMP b) and type is an integal type, return
+         new expression involving the new type.  */
+      if (COMPARISON_CLASS_P (op0) && INTEGRAL_TYPE_P (type))
+       return fold_build2 (TREE_CODE (op0), type, TREE_OPERAND (op0, 0),
+                           TREE_OPERAND (op0, 1));
 
       /* Handle cases of two conversions in a row.  */
       if (TREE_CODE (op0) == NOP_EXPR