aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2005-03-13 22:34:03 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2005-03-13 22:34:03 +0000
commit362cb1bb1f100075cb261248d64c7ba0cb748cec (patch)
treeb32aa07e2c73110ffba0edde92f3970f84f19c46 /gcc/tree.c
parent334f3a34cd96d89092c7551dc221ca1150fa4e07 (diff)
downloadgcc-362cb1bb1f100075cb261248d64c7ba0cb748cec.zip
gcc-362cb1bb1f100075cb261248d64c7ba0cb748cec.tar.gz
gcc-362cb1bb1f100075cb261248d64c7ba0cb748cec.tar.bz2
re PR middle-end/19331 (Inefficient code generated for bitfield assignment)
PR middle-end/19331 * tree.c (get_unwidened): Treat CONVERT_EXPR and NOP_EXPR identically. * fold-const.c (fold_sign_changed_comparison): Likewise. (fold_binary): Optimize comparisons against widened operands if the extension is represented by a CONVERT_EXPR, same as a NOP_EXPR. From-SVN: r96397
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 815ef75..0a99598 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4729,7 +4729,8 @@ get_unwidened (tree op, tree for_type)
&& TYPE_UNSIGNED (type));
tree win = op;
- while (TREE_CODE (op) == NOP_EXPR)
+ while (TREE_CODE (op) == NOP_EXPR
+ || TREE_CODE (op) == CONVERT_EXPR)
{
int bitschange
= TYPE_PRECISION (TREE_TYPE (op))
@@ -4759,7 +4760,9 @@ get_unwidened (tree op, tree for_type)
/* TYPE_UNSIGNED says whether this is a zero-extension.
Let's avoid computing it if it does not affect WIN
and if UNS will not be needed again. */
- if ((uns || TREE_CODE (op) == NOP_EXPR)
+ if ((uns
+ || TREE_CODE (op) == NOP_EXPR
+ || TREE_CODE (op) == CONVERT_EXPR)
&& TYPE_UNSIGNED (TREE_TYPE (op)))
{
uns = 1;