This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] More opportunities for fold_buildN
- From: Volker Reichelt <reichelt at igpm dot rwth-aachen dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 15 Aug 2005 18:28:40 +0200 (CEST)
- Subject: [patch] More opportunities for fold_buildN
The following patch uses fold_buildN in some more places.
Bootstrapped and regtested on i686-pc-linux-gnu.
Ok for mainline?
Regards,
Volker
2005-08-15 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* builtins.c (fold_builtin_isdigit): Use fold_buildN.
(build_function_call_expr): Likewise.
* c-typeck.c (c_finish_loop): Likewise.
===================================================================
--- gcc/gcc/builtins.c 12 Jul 2005 09:19:59 -0000 1.468
+++ gcc/gcc/builtins.c 15 Aug 2005 07:40:10 -0000
@@ -8291,9 +8291,8 @@ fold_builtin_isdigit (tree arglist)
arg = fold_convert (unsigned_type_node, TREE_VALUE (arglist));
arg = build2 (MINUS_EXPR, unsigned_type_node, arg,
build_int_cst (unsigned_type_node, target_digit0));
- arg = build2 (LE_EXPR, integer_type_node, arg,
- build_int_cst (unsigned_type_node, 9));
- arg = fold (arg);
+ arg = fold_build2 (LE_EXPR, integer_type_node, arg,
+ build_int_cst (unsigned_type_node, 9));
if (in_gimple_form && !TREE_CONSTANT (arg))
return NULL_TREE;
else
@@ -8929,9 +8928,8 @@ build_function_call_expr (tree fn, tree
tree call_expr;
call_expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn);
- call_expr = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)),
+ return fold_build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)),
call_expr, arglist, NULL_TREE);
- return fold (call_expr);
}
/* This function validates the types of a function call argument list
===================================================================
--- gcc/gcc/c-typeck.c 16 Jul 2005 14:34:37 -0000 1.465
+++ gcc/gcc/c-typeck.c 15 Aug 2005 07:41:36 -0000
@@ -7086,8 +7086,7 @@ c_finish_loop (location_t start_locus, t
}
t = build_and_jump (&blab);
- exit = build3 (COND_EXPR, void_type_node, cond, exit, t);
- exit = fold (exit);
+ exit = fold_build3 (COND_EXPR, void_type_node, cond, exit, t);
if (cond_is_first)
SET_EXPR_LOCATION (exit, start_locus);
else
===================================================================