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, Richard Guenther wrote:

> On Tue, 21 Aug 2007, Jakub Jelinek wrote:
> > 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).

Note we also may preserve previous behavior with something like

Index: tree-inline.c
===================================================================
*** tree-inline.c	(revision 127658)
--- tree-inline.c	(working copy)
*************** inlinable_function_p (tree fn)
*** 1920,1925 ****
--- 1920,1930 ----
  bool
  disregard_inline_limits_p (tree fn)
  {
+   /* GNU extern inline functions are supposed to be cheap.  */
+   if (DECL_DECLARED_INLINE_P (fn)
+       && DECL_EXTERNAL (fn))
+     return true;
+ 
    return lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) != NULL_TREE;
  }

(supposed that DECL_DECLARED_INLINE_P and DECL_EXTERNAL is not used with
different semantics in other frontends).  But I think this is the wrong
thing for -Os.

Richard.


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