This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix part of pr25505
Diego Novillo wrote:
> Diego Novillo wrote on 08/31/06 18:59:
>
>> FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, op_iter, SSA_OP_ALL_DEFS)
>> {
>> tree def = DEF_FROM_PTR (def_p);
>> def = SSA_NAME_VAR (def);
>> if (TREE_TYPE (def) == TREE_TYPE (call)
>> && MTAG_P (def)
>> && is_call_clobbered (def))
>> goto unsafe;
>> }
>>
>> Note that I'm not 100% sure if this type check is actually valid. But I
>> think it is.
>>
> Never mind. Silly idea. The individual tags will *not* have the type
> of the call. Sigh.
Now that I understand how to generate these trees, I've started looking
at a solution. Here's my general approach -- it's not perfect (it may
claim some things as clobbered that a finer investigation or pointer
aliasing would reveal aren't), but it's a whole lot better than what's
there now. If this seems like a reasonable direction, I'll get a formal
patch for review and run tests.
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;
}
}
- Josh