On Thu, Sep 22, 2011 at 12:52 AM, Jan Hubicka <hubi...@ucw.cz> wrote:
>
> Hi,
> ipa-inline-analysis use is_gimple_min_invariant that in turn require 
> current_function_decl
> to be set to the corresponding function or all addresses of automatic vars 
> are considered
> non-invariant.
>
> Bootstrapped/regtested x86_64-linux, will commit it shortly.

Ick.  Please instead consider adding variants which take a struct
function * to the various
predicates (I guess just decl_address_invariant_p is the real issue).
I'd name them
is_gimple_min_invariant_fn and decl_address_invariant_fn_p.

>        * ipa-inline-analsis.c (compute_inline_parameters): Set
>        cfun and current_function_decl.
>
> Index: ipa-inline-analysis.c
> ===================================================================
> --- ipa-inline-analysis.c       (revision 179046)
> +++ ipa-inline-analysis.c       (working copy)
> @@ -1694,6 +1724,7 @@ compute_inline_parameters (struct cgraph
>   HOST_WIDE_INT self_stack_size;
>   struct cgraph_edge *e;
>   struct inline_summary *info;
> +  tree old_decl = current_function_decl;
>
>   gcc_assert (!node->global.inlined_to);
>
> @@ -1718,6 +1749,10 @@ compute_inline_parameters (struct cgraph
>       return;
>     }
>
> +  /* Even is_gimple_min_invariant rely on current_function_decl.  */
> +  current_function_decl = node->decl;
> +  push_cfun (DECL_STRUCT_FUNCTION (node->decl));
> +
>   /* Estimate the stack size for the function if we're optimizing.  */
>   self_stack_size = optimize ? estimated_stack_frame_size (node) : 0;
>   info->estimated_self_stack_size = self_stack_size;
> @@ -1757,6 +1792,8 @@ compute_inline_parameters (struct cgraph
>   info->size = info->self_size;
>   info->stack_frame_offset = 0;
>   info->estimated_stack_size = info->estimated_self_stack_size;
> +  current_function_decl = old_decl;
> +  pop_cfun ();
>  }
>
>
>

Reply via email to