This is the mail archive of the gcc@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: issues with inlining


Michel LESPINASSE writes:
 > Hi Carlo,
 > 
 > On Thu, Dec 19, 2002 at 02:22:12AM +0100, Carlo Wood wrote:
 > > The following problems have been spotted:
 > 
 > [quoted below]
 > 
 > Did you get any replies to your email ? I've complained about just the
 > same issues previously without much success... issues 1) and 2) being
 > the most important for me.

 > 
 > Cheers,
 > 
 > > 1) -Winline doesn't give me a warning when a function is
 > >    not inlined, even while I am using the inline keyword
 > >    for it.
 > > 2) g++ 3.2.1 seems to totally ignore the inline keyword
 > >    and do as it pleases when being used with -O3.  
 > >    Unfortunately, I know better than the compiler what
 > >    should be inlined - so, ignoring the inline keyword
 > >    and inlining other functions results in much slower
 > >    code.

According to the docs

     `-O3' turns on all optimizations specified by `-O2' and also
     turns on the `inline-functions' option.

so why are you using -O3 if you want to control inlining by means of
the "inline" kwyword?

 > > 3) Apparently gcc is still inlining "top down", meaning
 > >    that when a() calls b() which calls c() which calls d(),
 > >    then b() is inlined into a(), c() is inlined into
 > >    d() and when then the function becomes too big, it
 > >    stops.  THIS IS HORRIBLE!!!  This *definitely* needs
 > >    to be changed into that d() is inlined into c(),
 > >    and if the function isn't getting too big, then c()
 > >    into b() etc.

We're working on it.

 > > 4) The instruction limit that can be set with -finline-limit
 > >    seems to count instructions before optimization...

True -- the inliner works at the source level before optimization is
performed.  This is the best way to do it.

Andrew.


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