This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Allow in-place gimple folding of OBJ_TYPE_REF
- From: Richard Guenther <rguenther at suse dot de>
- To: Martin Jambor <mjambor at suse dot cz>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 20 Sep 2010 14:51:02 +0200 (CEST)
- Subject: Re: [PATCH] Allow in-place gimple folding of OBJ_TYPE_REF
- References: <20100917161321.GH4049@virgil.arch.suse.de>
On Fri, 17 Sep 2010, Martin Jambor wrote:
> Hi,
>
> there is no reason why OBJ_TYPE_REF calls cannot be folded in-place.
> This patch allows that.
>
> Bootstrapped and tested on x86_64-linux, OK for trunk?
Ok.
Thanks,
Richard.
> Thanks,
>
> Martin
>
>
>
> 2010-09-16 Martin Jambor <mjambor@suse.cz>
>
> * gimple-fold.c (fold_gimple_call): New parameter inplace, do not fold
> builtins if it is true.
> (fold_stmt_1): Call, fold_gimple_call always, pass inplace as a
> parameter.
>
> Index: icln/gcc/gimple-fold.c
> ===================================================================
> --- icln.orig/gcc/gimple-fold.c
> +++ icln/gcc/gimple-fold.c
> @@ -1482,7 +1482,7 @@ gimple_fold_obj_type_ref (tree ref, tree
> It is assumed that the operands have been previously folded. */
>
> static bool
> -fold_gimple_call (gimple_stmt_iterator *gsi)
> +fold_gimple_call (gimple_stmt_iterator *gsi, bool inplace)
> {
> gimple stmt = gsi_stmt (*gsi);
>
> @@ -1490,7 +1490,7 @@ fold_gimple_call (gimple_stmt_iterator *
>
> /* Check for builtins that CCP can handle using information not
> available in the generic fold routines. */
> - if (callee && DECL_BUILT_IN (callee))
> + if (!inplace && callee && DECL_BUILT_IN (callee))
> {
> tree result = gimple_fold_builtin (stmt);
>
> @@ -1507,7 +1507,6 @@ fold_gimple_call (gimple_stmt_iterator *
> there requires that we create a new CALL_EXPR, and that requires
> copying EH region info to the new node. Easier to just do it
> here where we can just smash the call operand. */
> - /* ??? Is there a good reason not to do this in fold_stmt_inplace? */
> callee = gimple_call_fn (stmt);
> if (TREE_CODE (callee) == OBJ_TYPE_REF
> && TREE_CODE (OBJ_TYPE_REF_OBJECT (callee)) == ADDR_EXPR)
> @@ -1574,9 +1573,7 @@ fold_stmt_1 (gimple_stmt_iterator *gsi,
> changed = true;
> }
> }
> - /* The entire statement may be replaced in this case. */
> - if (!inplace)
> - changed |= fold_gimple_call (gsi);
> + changed |= fold_gimple_call (gsi, inplace);
> break;
>
> case GIMPLE_ASM:
>
>
--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex