[PATCH] Fix part of pr25505
Diego Novillo
dnovillo@redhat.com
Fri Sep 1 12:39:00 GMT 2006
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'.
More information about the Gcc-patches
mailing list