This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix part of pr25505
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Josh Conner <jconner at apple dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 01 Sep 2006 08:39:07 -0400
- Subject: Re: [PATCH] Fix part of pr25505
- References: <44F6DBB3.2080809@apple.com> <44F769D1.1010205@redhat.com> <44F76AAE.7000601@redhat.com> <44F76EB9.3010103@apple.com>
Josh Conner wrote on 08/31/06 19:20:
> static unsigned int
> dest_safe_for_nrv_p (tree dest)
> {
> switch (TREE_CODE (dest))
> {
> case VAR_DECL:
> {
> subvar_t subvar;
> if (is_call_clobbered (dest))
> return 0;
> for (subvar = get_subvars_for_var (dest);
> subvar;
> subvar = subvar->next)
> if (is_call_clobbered (subvar->var))
> return 0;
> return 1;
> }
> case ARRAY_REF:
> case COMPONENT_REF:
> return dest_safe_for_nrv_p (TREE_OPERAND (dest, 0));
> default:
> return 0;
> }
> }
>
Yeah, that should work. You may want to handle INDIRECT_REF by
recursing with the memory tag associated with its underlying pointer.
Definitely not 4.2 material, though (unless the memory savings on this
PR are sufficiently compelling and you can make a good case for the
safety of this patch).
Also, dest_safe_for_nrv_p ought to return 'bool'.