[tree-ssa] Removing useless/redundant "const" calls
Diego Novillo
dnovillo@redhat.com
Thu Jun 12 15:22:00 GMT 2003
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.
More information about the Gcc-patches
mailing list