This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Inlining fails on very simple code
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: degger at fhm dot edu
- Cc: gcc at gcc dot gnu dot org
- Date: 11 Dec 2001 19:17:19 -0200
- Subject: Re: Inlining fails on very simple code
- Organization: GCC Team, Red Hat
- References: <20011211190118.D6DAD8CC0@Nicole.fhm.edu>
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