diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-13 22:34:03 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-13 22:34:03 +0000 |
commit | a846fd4dd7670d50a2181ce5958147146e93f4c6 (patch) | |
tree | b32aa07e2c73110ffba0edde92f3970f84f19c46 /gcc/tree.c | |
parent | 26d1b1789fb3a648be703c1744fd86a6ff54e183 (diff) | |
download | ppe42-gcc-a846fd4dd7670d50a2181ce5958147146e93f4c6.tar.gz ppe42-gcc-a846fd4dd7670d50a2181ce5958147146e93f4c6.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96397 138bc75d-0d04-0410-961f-82ee72b054a4
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; |