Hi,

On Mon, 21 May 2012, Richard Guenther wrote:

> This removes the code that makes us walk DECL_INITIAL (recursively)
> on add_referenced_var - one source of compile-time hogs in the past
> and not strictly necessary.

For this to be a compile time hog, ...

>    if (referenced_var_check_and_insert (var))
> -    {
> -      /* Scan DECL_INITIAL for pointer variables as they may contain
> -      address arithmetic referencing the address of other
> -      variables.  As we are only interested in directly referenced
> -      globals or referenced locals restrict this to initializers
> -      than can refer to local variables.  */
> -      if (DECL_INITIAL (var)
> -          && DECL_CONTEXT (var) == current_function_decl)
> -             walk_tree (&DECL_INITIAL (var), find_vars_r, NULL, 0);

... DECL_INITIAL must be non-zero often.  Two cases:
a) the transformation (presumably gimplification) that transformed 
   DECL_INITIALIZER into explicit statements left DECL_INITIALIZER 
   uselessly set
b) not all (local) DECL_INITIALIZERs are transformed into explicit 
   statements

If the former, then the above really is dead code as you rely on, though 
it probably would be good to zero out DECL_INITIALIZER at transformation 
time.  In case b) your patch is incorrect as it would leave out marking 
things as referenced which are referenced from only that initializer.

So, which is it? :)


Ciao,
Michael.

Reply via email to