fold-const.c (fold): STRIP_NOPS when deciding whether or not something is a candidate...
authorMark Mitchell <mark@codesourcery.com>
Wed, 26 May 1999 09:50:08 +0000 (09:50 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 26 May 1999 09:50:08 +0000 (09:50 +0000)
        * fold-const.c (fold): STRIP_NOPS when deciding whether or not
something is a candidate for optimize_bit_field_compare.

From-SVN: r27169

gcc/ChangeLog
gcc/fold-const.c

index 34f612d36a550641c89f671ed177293ad2d7502e..2739bd98d9715bc7f18cafc51d666a1c9eecc1cc 100644 (file)
@@ -1,3 +1,8 @@
+Wed May 26 09:53:05 1999  Mark Mitchell  <mark@codesourcery.com>
+
+        * fold-const.c (fold): STRIP_NOPS when deciding whether or not
+       something is a candidate for optimize_bit_field_compare.
+
 Wed May 26 09:40:02 1999  Mark Mitchell  <mark@codesourcery.com>
 
        * gcc.texi (Passes): Document branch-shortening.
index 6acbe0baf34d7e0dacbf22eb5307ccd9c83ea0b9..b67ff82868dfebc643961f5269c53cc32a757343 100644 (file)
@@ -6036,16 +6036,20 @@ fold (expr)
        }
 
       /* If this is a comparison of a field, we may be able to simplify it.  */
-      if ((TREE_CODE (arg0) == COMPONENT_REF
-          || TREE_CODE (arg0) == BIT_FIELD_REF)
-         && (code == EQ_EXPR || code == NE_EXPR)
-         /* Handle the constant case even without -O
-            to make sure the warnings are given.  */
-         && (optimize || TREE_CODE (arg1) == INTEGER_CST))
-       {
-         t1 = optimize_bit_field_compare (code, type, arg0, arg1);
-         return t1 ? t1 : t;
-       }
+      {
+       tree xarg0 = arg0;
+       STRIP_NOPS (xarg0);
+       if ((TREE_CODE (xarg0) == COMPONENT_REF
+            || TREE_CODE (xarg0) == BIT_FIELD_REF)
+           && (code == EQ_EXPR || code == NE_EXPR)
+           /* Handle the constant case even without -O
+              to make sure the warnings are given.  */
+           && (optimize || TREE_CODE (arg1) == INTEGER_CST))
+         {
+           t1 = optimize_bit_field_compare (code, type, xarg0, arg1);
+           return t1 ? t1 : t;
+         }
+      }
 
       /* If this is a comparison of complex values and either or both sides
         are a COMPLEX_EXPR or COMPLEX_CST, it is best to split up the