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: [lto][patch] Clear DECL_CONTEXT of PARM_DECL


On Mon, Jan 19, 2009 at 14:02, Rafael Espindola <espindola@google.com> wrote:

> @@ -4069,6 +4069,9 @@ reset_decl_lang_specific (void **slot, void *unused ATTRIBUTE_UNUSED)
>    TREE_LANG_FLAG_5 (decl) = 0;
>    TREE_LANG_FLAG_6 (decl) = 0;
>
> +  if (TREE_CODE (decl) == PARM_DECL)
> +    DECL_CONTEXT (decl) = NULL_TREE;
> +

This isn't right.  If you set the context to NULL, the optimizers
will think that PARM_DECLs are call-clobbered, but they aren't.
The right thing here is to set them to the FUNCTION_DECL to which
they belong.  If the function has been inlined the inliner will
set it to the caller function.  For nested functions, the
unnester should set it to the function we are nesting into.

This would avoid special casing PARM_DECLs all over the place.
But setting DECL_CONTEXT to NULL here is certainly not right.
We should not be special-casing PARM_DECLs here.

Your explanation for this patch also doesn't seem to agree with
what you are doing here.  You say that PARM_DECLs should be
local, and yet you are converting them into globals.

Is there a test case you could post?  I'm not following what you are after.


Thanks.  Diego.


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