summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-22 19:22:21 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-22 19:22:21 +0000
commit8aa776bebd9a4d6e485c99e5e8ca9d5ddedc3f2c (patch)
tree6be3829aae3c9a7f5466fdc27a465d827c850835 /gcc/fold-const.c
parentd79c03041d153f440c38950d247fc62f0bc67983 (diff)
downloadgcc-8aa776bebd9a4d6e485c99e5e8ca9d5ddedc3f2c.tar.gz
2005-11-22 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/23606 * fold-const.c (fold_unary) <case NOP_EXPR, CONVERT_EXPR>: For COMPARISON_CLASS_P and an integral types create create a new expression with the new type and fold that. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107370 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e7f550b2038..2d750f6c94c 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -6771,6 +6771,12 @@ fold_unary (enum tree_code code, tree type, tree op0)
case FIX_ROUND_EXPR:
if (TREE_TYPE (op0) == type)
return op0;
+
+ /* If we have (type) (a CMP b) and type is an integal type, return
+ new expression involving the new type. */
+ if (COMPARISON_CLASS_P (op0) && INTEGRAL_TYPE_P (type))
+ return fold_build2 (TREE_CODE (op0), type, TREE_OPERAND (op0, 0),
+ TREE_OPERAND (op0, 1));
/* Handle cases of two conversions in a row. */
if (TREE_CODE (op0) == NOP_EXPR