This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix part of pr25505


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'.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]