From 362cb1bb1f100075cb261248d64c7ba0cb748cec Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Sun, 13 Mar 2005 22:34:03 +0000 Subject: 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 --- gcc/tree.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc/tree.c') 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; -- cgit v1.1