This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Removing useless/redundant "const" calls
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: 12 Jun 2003 10:33:49 -0400
- Subject: Re: [tree-ssa] Removing useless/redundant "const" calls
- Organization: Red Hat Canada
- References: <200306120502.h5C525sm016627@speedy.slc.redhat.com>
On Thu, 2003-06-12 at 01:02, law@redhat.com wrote:
> Index: gimplify.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/Attic/gimplify.c,v
> retrieving revision 1.1.2.54
> diff -c -3 -p -r1.1.2.54 gimplify.c
> *** gimplify.c 11 Jun 2003 02:50:56 -0000 1.1.2.54
> --- gimplify.c 12 Jun 2003 05:01:08 -0000
> *************** simplify_call_expr (expr_p, pre_p, post_
> *** 1404,1409 ****
> --- 1404,1415 ----
> is_simple_id, fb_rvalue);
> simplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p,
> is_simple_arglist, fb_rvalue);
> +
> + /* If the function is "const", then clear TREE_SIDE_EFFECTS on its
> + decl. This allows us to eliminate redundant or useless
> + calls to "const" functions. */
> + if (decl && TREE_READONLY (decl) && ! TREE_THIS_VOLATILE (decl))
> + TREE_SIDE_EFFECTS (*expr_p) = 0;
> }
>
Shouldn't we be using flags_from_decl_or_type here? You can call
tree-cfg.c:call_expr_flags() with the CALL_EXPR directly.
Diego.