From: Roger Sayle Date: Fri, 21 May 2004 16:39:38 +0000 (+0000) Subject: fold-const.c (fold, [...]): Use fold_convert instead of convert. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b953ebd647221fbd17b033b90eaa5503e66b0019;p=platform%2Fupstream%2Fgcc.git fold-const.c (fold, [...]): Use fold_convert instead of convert. * fold-const.c (fold, fold_relational_hi_lo, nondestructive_fold_binary_to_constant, fold_read_from_constant_string): Use fold_convert instead of convert. * builtins.c (simplify_builtin, simplify_builtin_strstr, simplify_builtin_strchr, simplify_builtin_strrchr, simplify_builtin_strpbrk): Use fold_convert instead of convert. From-SVN: r82102 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c6fd5c7..943e5de 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-05-21 Roger Sayle + + * fold-const.c (fold, fold_relational_hi_lo, + nondestructive_fold_binary_to_constant, + fold_read_from_constant_string): Use fold_convert instead of convert. + * builtins.c (simplify_builtin, simplify_builtin_strstr, + simplify_builtin_strchr, simplify_builtin_strrchr, + simplify_builtin_strpbrk): Use fold_convert instead of convert. + 2004-05-21 Diego Novillo * tree-flow-inline.h (num_immediate_uses): Don't abort if DF diff --git a/gcc/builtins.c b/gcc/builtins.c index 7643b2d..0357ca9 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -8020,7 +8020,7 @@ simplify_builtin (tree exp, int ignore) } if (val) - val = convert (TREE_TYPE (exp), val); + val = fold_convert (TREE_TYPE (exp), val); return val; } @@ -8061,13 +8061,13 @@ simplify_builtin_strstr (tree arglist) { const char *r = strstr (p1, p2); - /* Return an offset into the constant string argument. */ if (r == NULL) - return integer_zero_node; - else - return fold (build (PLUS_EXPR, TREE_TYPE (s1), - s1, convert (TREE_TYPE (s1), - ssize_int (r - p1)))); + return fold_convert (TREE_TYPE (s1), integer_zero_node); + + /* Return an offset into the constant string argument. */ + return fold (build2 (PLUS_EXPR, TREE_TYPE (s1), + s1, fold_convert (TREE_TYPE (s1), + ssize_int (r - p1)))); } if (p2[0] == '\0') @@ -8130,12 +8130,12 @@ simplify_builtin_strchr (tree arglist) r = strchr (p1, c); if (r == NULL) - return integer_zero_node; + return fold_convert (TREE_TYPE (s1), integer_zero_node); /* Return an offset into the constant string argument. */ return fold (build (PLUS_EXPR, TREE_TYPE (s1), - s1, convert (TREE_TYPE (s1), - ssize_int (r - p1)))); + s1, fold_convert (TREE_TYPE (s1), + ssize_int (r - p1)))); } /* FIXME: Should use here strchrM optab so that ports can optimize @@ -8187,12 +8187,12 @@ simplify_builtin_strrchr (tree arglist) r = strrchr (p1, c); if (r == NULL) - return integer_zero_node; + return fold_convert (TREE_TYPE (s1), integer_zero_node); /* Return an offset into the constant string argument. */ return fold (build (PLUS_EXPR, TREE_TYPE (s1), - s1, convert (TREE_TYPE (s1), - ssize_int (r - p1)))); + s1, fold_convert (TREE_TYPE (s1), + ssize_int (r - p1)))); } if (! integer_zerop (s2)) @@ -8245,12 +8245,12 @@ simplify_builtin_strpbrk (tree arglist) const char *r = strpbrk (p1, p2); if (r == NULL) - return integer_zero_node; + return fold_convert (TREE_TYPE (s1), integer_zero_node); /* Return an offset into the constant string argument. */ return fold (build (PLUS_EXPR, TREE_TYPE (s1), - s1, convert (TREE_TYPE (s1), - ssize_int (r - p1)))); + s1, fold_convert (TREE_TYPE (s1), + ssize_int (r - p1)))); } if (p2[0] == '\0') diff --git a/gcc/fold-const.c b/gcc/fold-const.c index c4a53e0..2c89c5b 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -5831,7 +5831,7 @@ fold (tree expr) tree s1 = TYPE_SIZE (tt1); if (s0 && s1 && operand_equal_p (s0, s1, OEP_ONLY_CONST)) - return build2 (TREE_CODE (arg0), t0, convert (t0, arg00), + return build2 (TREE_CODE (arg0), t0, fold_convert (t0, arg00), TREE_OPERAND (arg0, 1)); } @@ -9147,14 +9147,14 @@ fold_relational_hi_lo (enum tree_code *code_p, const tree type, tree *op0_p, { case GT_EXPR: return omit_one_operand (type, - convert (type, integer_zero_node), + fold_convert (type, integer_zero_node), op0); case GE_EXPR: *code_p = EQ_EXPR; break; case LE_EXPR: return omit_one_operand (type, - convert (type, integer_one_node), + fold_convert (type, integer_one_node), op0); case LT_EXPR: *code_p = NE_EXPR; @@ -9187,7 +9187,7 @@ fold_relational_hi_lo (enum tree_code *code_p, const tree type, tree *op0_p, { case LT_EXPR: return omit_one_operand (type, - convert (type, integer_zero_node), + fold_convert (type, integer_zero_node), op0); case LE_EXPR: *code_p = EQ_EXPR; @@ -9195,7 +9195,7 @@ fold_relational_hi_lo (enum tree_code *code_p, const tree type, tree *op0_p, case GE_EXPR: return omit_one_operand (type, - convert (type, integer_one_node), + fold_convert (type, integer_one_node), op0); case GT_EXPR: *code_p = NE_EXPR; @@ -9236,8 +9236,8 @@ fold_relational_hi_lo (enum tree_code *code_p, const tree type, tree *op0_p, exp = build2 (code == LE_EXPR ? GE_EXPR: LT_EXPR, type, - convert (st0, op0), - convert (st1, integer_zero_node)); + fold_convert (st0, op0), + fold_convert (st1, integer_zero_node)); retval = nondestructive_fold_binary_to_constant (TREE_CODE (exp), @@ -9341,7 +9341,7 @@ nondestructive_fold_binary_to_constant (enum tree_code code, tree type, /* The return value should always have the same type as the original expression. */ if (TREE_TYPE (tem) != type) - tem = convert (type, tem); + tem = fold_convert (type, tem); return tem; } @@ -9354,7 +9354,7 @@ nondestructive_fold_binary_to_constant (enum tree_code code, tree type, Also note that operand_equal_p is always false if an operand is volatile. */ if (! FLOAT_TYPE_P (type) && operand_equal_p (op0, op1, 0)) - return convert (type, integer_zero_node); + return fold_convert (type, integer_zero_node); goto binary; @@ -9670,7 +9670,7 @@ fold_read_from_constant_string (tree exp) { tree domain = TYPE_DOMAIN (TREE_TYPE (exp1)); tree low_bound = domain ? TYPE_MIN_VALUE (domain) : integer_zero_node; - index = convert (sizetype, TREE_OPERAND (exp, 1)); + index = fold_convert (sizetype, TREE_OPERAND (exp, 1)); /* Optimize the special-case of a zero lower bound. @@ -9680,7 +9680,7 @@ fold_read_from_constant_string (tree exp) +(INDEX-(unsigned char)1)) becomes ((ARRAY+(-(unsigned char)1)) +INDEX), which becomes (ARRAY+255+INDEX). Opps!) */ if (! integer_zerop (low_bound)) - index = size_diffop (index, convert (sizetype, low_bound)); + index = size_diffop (index, fold_convert (sizetype, low_bound)); string = exp1; }