From: Roger Sayle Date: Fri, 19 Jan 2007 00:30:47 +0000 (+0000) Subject: fold-const.c (fold_unary): Optimize away a VIEW_CONVERT_EXPR to the same type as... X-Git-Tag: releases/gcc-4.3.0~7392 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f85242f0ce997c299c1a07f5fe94f5ffe63bf599;p=thirdparty%2Fgcc.git fold-const.c (fold_unary): Optimize away a VIEW_CONVERT_EXPR to the same type as it's operand. * fold-const.c (fold_unary) : Optimize away a VIEW_CONVERT_EXPR to the same type as it's operand. From-SVN: r120945 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 99a58708ceee..c2e1f701d0cb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2007-01-18 Roger Sayle + + * fold-const.c (fold_unary) : Optimize away a + VIEW_CONVERT_EXPR to the same type as it's operand. + 2007-01-18 David Edelsohn * config/rs6000/darwin-ldouble.c: Only build _SOFT_FLOAT if diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 2ae560fa3bda..5588c37a7e32 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7573,6 +7573,8 @@ fold_unary (enum tree_code code, tree type, tree op0) return tem ? tem : NULL_TREE; case VIEW_CONVERT_EXPR: + if (TREE_TYPE (op0) == type) + return op0; if (TREE_CODE (op0) == VIEW_CONVERT_EXPR) return fold_build1 (VIEW_CONVERT_EXPR, type, TREE_OPERAND (op0, 0)); return fold_view_convert_expr (type, op0);