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: [PATCH][C++] Remove auto_var_in_fn langhook


On Tue, 21 Aug 2007, Jakub Jelinek wrote:

> On Mon, Aug 20, 2007 at 01:32:11PM +0200, Richard Guenther wrote:
> > On Wed, 1 Aug 2007, Mark Mitchell wrote:
> > 
> > > Richard Guenther wrote:
> > > 
> > > > 2007-07-26  Richard Guenther  <rguenther@suse.de>
> > > > 
> > > > 	* langhooks-def.h (lhd_tree_inlining_auto_var_in_fn_p): Remove.
> > > > 	(LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P): Likewise.
> > > > 	(LANG_HOOKS_TREE_INLINING_INITIALIZER): Remove initializer for
> > > > 	auto_var_in_fn_p langhook.
> > > > 	* langhooks.c (lhd_tree_inlining_auto_var_in_fn_p): Rename and
> > > > 	move ...
> > > > 	* tree.c (auto_var_in_fn_p): ... here.
> > > > 	(find_var_from_fn): Call auto_var_in_fn_p directly.
> > > > 	* langhooks.h (lang_hooks_for_tree_inlining): Remove
> > > > 	auto_var_in_fn_p langhook.
> > > > 	* tree-inline.c (remap_decls): Call auto_var_in_fn_p directly.
> > > > 	(copy_body_r): Likewise.
> > > > 	(self_inlining_addr_expr): Likewise.
> > > > 	* tree.h (auto_var_in_fn_p): Declare.
> > > > 
> > > > 	cp/
> > > > 	* cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P):
> > > > 	Remove.
> > > > 	* cp-tree.h (cp_auto_var_in_fn_p): Remove.
> > > > 	* tree.c (cp_auto_var_in_fn_p): Remove.
> > > 
> > > OK.  I think this means nonstatic_local_decl_p is dead now too, so feel
> > > free to remove that as well.
> > 
> > Right.  Done.
> 
> One of the -r127641:127644 changes causes
> FAIL: gcc.c-torture/execute/20010119-1.c compilation,  -Os
> regression on x86_64-linux.  The inline fn is no longer inlined and as it
> is extern inline in gnu89 mode, we get undefined reference.
> In this particular case inlining it is a net win even for -Os, as it is
> completely optimized out.

I didn't see this failure with the original testing.  This is caused by
the disregard_inline_limits langhook removal where I changed the C 
frontend to not disregard inline limits for extern inline functions.
For -Os heuristics now decide that it is not profitable to inline this
function.  As extern inline with gnu semantics says that there is an
extern instance of this function we get a link time error for this
testcase at -Os.

Considering foo with 23 insns
 to be inlined into main
 Estimated growth after inlined into all callees is +5 insns.
 Estimated badness is 17, frequency 1.00.
 inline_failed:call is unlikely.

(16 of the cost is because of our atm artificially high call cost
which is accounted to the call to undef(), the rest is the single
addition and the 3 conditionals with their comparisons)

I suppose we should disable the test for -Os or wait for the inliner
tunings (we have another PR about the high call cost, experiments showed
8 is a more reasonable value which would fix this testcase as well, but
the tuning waits for the early DSE work).

Richard.


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