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: Inlining fails on very simple code


On Dec 11, 2001, degger@fhm.edu wrote:

> Would it be possible to use the bitfield variable behind the
> TREE_USED macro to count the number of callers or would that already
> be to late for the treeinliner to work with that data?

Well, considering that it's a single bit, you wouldn't be able to take
much information out of it.  Besides, it would only be sensible to use
it after you get the whole translation unit processed, and GCC emits
code for functions *before* it gets the whole translation unit.

Also, sometimes optimizing a function may get you rid of references to
other functions (think unreachable code), and then, you'd have to
somehow go back and update the counter, or risk making imperfect
choices.

> Also I think it might be benefitial to generally inline the tree if
> the inline keyword is given or the inlining criteria are met but
> also keep the copy of the function alone around, do the optimisation
> passes on the code with the inlined function and both the callee and
> caller alone and then compare them and decide whether the glued code
> shows an improvement over both functions alone.

And what if you have n function calls that you could inline, do you
try 2^n combinations of inlining, optimize them all the way through to
assembly code, and then pick the best?  This may indeed get you a
compiler that generates fast code, but it's going to be unbearably
slow.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


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