* Switch function context when doing inline analysis
@ 2011-09-21 23:47 Jan Hubicka
2011-09-24 13:38 ` Richard Guenther
0 siblings, 1 reply; 2+ messages in thread
From: Jan Hubicka @ 2011-09-21 23:47 UTC (permalink / raw)
To: gcc-patches
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.
* 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 ();
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Switch function context when doing inline analysis
2011-09-21 23:47 Switch function context when doing inline analysis Jan Hubicka
@ 2011-09-24 13:38 ` Richard Guenther
0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2011-09-24 13:38 UTC (permalink / raw)
To: Jan Hubicka; +Cc: gcc-patches
On Thu, Sep 22, 2011 at 12:52 AM, Jan Hubicka <hubicka@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 ();
> }
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-24 10:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-21 23:47 Switch function context when doing inline analysis Jan Hubicka
2011-09-24 13:38 ` Richard Guenther
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).