From: Richard Guenther Date: Fri, 2 Dec 2005 09:38:57 +0000 (+0000) Subject: convert.c (convert_to_integer): Use fold_convert instead of fold_build1 (NOP_EXPR... X-Git-Tag: releases/gcc-4.2.0~5620 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7a6c1272ccfdeb0d21001de0f2cbd442d6b0af9;p=thirdparty%2Fgcc.git convert.c (convert_to_integer): Use fold_convert instead of fold_build1 (NOP_EXPR, ...). 2005-12-02 Richard Guenther * convert.c (convert_to_integer): Use fold_convert instead of fold_build1 (NOP_EXPR, ...). Use tree_int_cst_sgn < 0 instead of comparing against 0. Use build_int_cst instead of converting integer_zero_node. From-SVN: r107881 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e8ff5710e8fd..b521d3f506c9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2005-12-02 Richard Guenther + + * convert.c (convert_to_integer): Use fold_convert instead + of fold_build1 (NOP_EXPR, ...). Use tree_int_cst_sgn < 0 + instead of comparing against 0. Use build_int_cst instead + of converting integer_zero_node. + 2005-12-02 Richard Guenther * tree-pretty-print.c (op_symbol): Handle LROTATE_EXPR diff --git a/gcc/convert.c b/gcc/convert.c index beebf047b787..ece3637e93d4 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -420,7 +420,7 @@ convert_to_integer (tree type, tree expr) expr = fold_build1 (CONVERT_EXPR, lang_hooks.types.type_for_size (POINTER_SIZE, 0), expr); - return fold_build1 (NOP_EXPR, type, expr); + return fold_convert (type, expr); case INTEGER_TYPE: case ENUMERAL_TYPE: @@ -500,9 +500,7 @@ convert_to_integer (tree type, tree expr) /* We can pass truncation down through right shifting when the shift count is a nonpositive constant. */ if (TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST - && tree_int_cst_lt (TREE_OPERAND (expr, 1), - convert (TREE_TYPE (TREE_OPERAND (expr, 1)), - integer_one_node))) + && tree_int_cst_sgn (TREE_OPERAND (expr, 1)) < 0) goto trunc1; break; @@ -528,7 +526,7 @@ convert_to_integer (tree type, tree expr) but (int) a << 32 is undefined and would get a warning. */ - tree t = convert_to_integer (type, integer_zero_node); + tree t = build_int_cst (type, 0); /* If the original expression had side-effects, we must preserve it. */