On Fri, Jan 10, 2020 at 1:55 AM Gary Oblock <gobl...@marvell.com> wrote:
>
> This is at LTO time and the function in question is this:
>
> #include "stdlib.h"
> typedef struct bogus type_ta;
>
> struct bogus {
>   int i;
>   double x;
>   int j;
> };
>
> void
> helper( void *x)
> {
>   type_ta *y = (type_ta*)x;
>   y->i =  rand();
> }
>
> and I'm checking the local_decls it like this:
>
>   cgraph_node* node;
>   FOR_EACH_FUNCTION_WITH_GIMPLE_BODY ( node)
>   {
>     tree decl;
>     unsigned i;
>
>     node->get_untransformed_body ();
>
>     struct function *fn = DECL_STRUCT_FUNCTION ( node->decl);
>     DEBUG( "L# %d, fuction name = %s\n", __LINE__, 
> lang_hooks.decl_printable_name ( node->decl, 2));
>     if( fn == NULL )
>     {
>       DEBUG( "  EMPTY\n");
>       continue;
>     }
>
>     FOR_EACH_LOCAL_DECL ( fn, i, decl)
>     {
>       tree base = base_type_of ( decl);
>       DEBUG( "L# %d Consider local var decl\n", __LINE__);
>       .
>       .
>
> Needless to sat I get the function name "helper" but no variables.
> I suspected the LTO streaming process but that seems bullet proof
> and if local_decls are there when streaming out it should be restored when
> streaming in. I also suspected inlining but it still happened with
> "-fno-inline" present.
>
> If you'll note the get_untransformed_body call above (which David Malcolm
> suggested to cure a NULL fn) I suspect I'm lacking some other call
> which will make all things right.

If you look at the functions IL it might be there's only anonymous SSA
names left,
those are not visited by FOR_EACH_LOCAL_DECL.

Richard.

> Thanks,
>
> Gary Oblock
>
>
>

Reply via email to