aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2007-01-19 00:30:47 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2007-01-19 00:30:47 +0000
commitf85242f0ce997c299c1a07f5fe94f5ffe63bf599 (patch)
treebeee2e7571eb302362386c8264bf2c958e486978 /gcc/fold-const.c
parent63d71dea804d48244d7bdd506d8ae48f2f312b3b (diff)
downloadgcc-f85242f0ce997c299c1a07f5fe94f5ffe63bf599.zip
gcc-f85242f0ce997c299c1a07f5fe94f5ffe63bf599.tar.gz
gcc-f85242f0ce997c299c1a07f5fe94f5ffe63bf599.tar.bz2
fold-const.c (fold_unary): Optimize away a VIEW_CONVERT_EXPR to the same type as it's operand.
* fold-const.c (fold_unary) <VIEW_CONVERT_EXPR>: Optimize away a VIEW_CONVERT_EXPR to the same type as it's operand. From-SVN: r120945
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 2ae560f..5588c37 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);