This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Inlining heuristics for C++
- To: Mark Mitchell <mark at codesourcery dot com>
- Subject: Re: Inlining heuristics for C++
- From: Daniel Berlin <dan at cgsoftware dot com>
- Date: Tue, 10 Jul 2001 03:09:19 -0400
- Cc: Daniel Berlin <dan at cgsoftware dot com>,"gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- References: <398850000.994745191@warlock.codesourcery.com>
Mark Mitchell <mark@codesourcery.com> writes:
> --On Monday, July 09, 2001 09:46:59 PM -0400 Daniel Berlin
> <dan@cgsoftware.com> wrote:
>
>> Right now, they are horrific.
>
> Hey, thanks a lot. :-) They are, actually, the same ones we had in
> the RTL inliner, just about -- except that we can inline so much more!
>
> I think your ideas are reasonable. Nathan Sidwell has been thinking
> about these issues, too; you should coordinate with him to try to
> get some decent ideas and some decent measurements.
>
> One long-term challenge is that we would like to inline when somehow
> that allows major simplifications. For example, if there is a giant
> function involving tons of calcuation, but we know that the argument
> is `3', and that means we can fold all the calculations, then we
> should do the inlining, even if the inlined function is nominally
> giant. I have no idea how to do this, though. It's probably not worth
> bothering about.
This is procedure cloning.
The cheap way is to clone the procedure (with whatever arguments are
constant now omitted from the call), optimize it, see if it
helped relative to the original procedure, if so, change the cloned
name, and the call to match the new cloned name/arguments.
If we find somewhere else compatible with the new arguments, reuse the
cloned procedures.
Picking which procedures to clone is tricky.
See "Aggressive inlining" (Ayers, Gottlieb, Schooler) for more details
(They are HP compiler people, the paper goes into stats about how much
procedure cloning alone vs inlining alone vs both combined helps).
--Dan
>
> --
> Mark Mitchell mark@codesourcery.com
> CodeSourcery, LLC http://www.codesourcery.com
--
"Is it weird in here, or is it just me?
"-Steven Wright