aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-05-26 09:50:08 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-05-26 09:50:08 +0000
commitb7f2c1fc1b35311b3aa2c91f896bebef99627167 (patch)
treed0255fced8e152416795cc0a88338b002ca6e8b8 /gcc/fold-const.c
parentf20b5577f8d9aeada63329b028d91769c7df4884 (diff)
downloadgcc-b7f2c1fc1b35311b3aa2c91f896bebef99627167.zip
gcc-b7f2c1fc1b35311b3aa2c91f896bebef99627167.tar.gz
gcc-b7f2c1fc1b35311b3aa2c91f896bebef99627167.tar.bz2
fold-const.c (fold): STRIP_NOPS when deciding whether or not something is a candidate for...
* fold-const.c (fold): STRIP_NOPS when deciding whether or not something is a candidate for optimize_bit_field_compare. From-SVN: r27169
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 6acbe0b..b67ff82 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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