From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Berlin To: Mark Mitchell Cc: Daniel Berlin , "gcc@gcc.gnu.org" Subject: Re: Inlining heuristics for C++ Date: Tue, 10 Jul 2001 00:09:00 -0000 Message-id: <87n16dl0ps.fsf@cgsoftware.com> References: <398850000.994745191@warlock.codesourcery.com> X-SW-Source: 2001-07/msg00721.html Mark Mitchell writes: > --On Monday, July 09, 2001 09:46:59 PM -0400 Daniel Berlin > 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