diff options
author | Roger Sayle <roger@eyesopen.com> | 2005-03-13 22:34:03 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2005-03-13 22:34:03 +0000 |
commit | 362cb1bb1f100075cb261248d64c7ba0cb748cec (patch) | |
tree | b32aa07e2c73110ffba0edde92f3970f84f19c46 /gcc/tree.c | |
parent | 334f3a34cd96d89092c7551dc221ca1150fa4e07 (diff) | |
download | gcc-362cb1bb1f100075cb261248d64c7ba0cb748cec.tar.gz |
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.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index 815ef7505fc..0a99598123a 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; |