Hi, On Thu, Mar 07, 2013 at 01:28:49PM +0400, Dinar Temirbulatov wrote: > On Wed, Mar 6, 2013 at 4:43 PM, Martin Jambor <mjam...@suse.cz> wrote: > > On Wed, Mar 06, 2013 at 04:00:52PM +0400, Dinar Temirbulatov wrote:
... > >> Here is what I mean: > >> > >> int func(int a, .....) > >> { > >> if (a==some_constant) > >> func.constprop.0(....); > >> > >> thanks, Dinar. > > > > well, you could just as well put the quick version right into the > > original function (and execute the original in the else branch). If > > it is small and you did this in an early pass, IPA-SPLIT might even > > help inliner to inline it into known callers. > yes, the function cloning is just one example here. Well, speculatively adding quick paths to functions might help some but I am not sure the cloning infrastructure is well suited to be used somehow directly. It also appears to be a rather completely intra-procedural undertaking as well. > > > > The tough part, however, is determining when this is such a good idea. > > Do you have any particular situation in mind? > I don't have. But for function cloning for example > good_cloning_opportunity_p() is a good point to start. > But that function requires frequency information which you do not have (without profile info but if you insist on having that, you might as well investigate improving value profiling). It is also meant to be called to inquire about a particular value of a parameter, and without seeing the calling CU you would not know which values are passed in those parameters at all. Martin