On Wed, Mar 6, 2013 at 4:43 PM, Martin Jambor <mjam...@suse.cz> wrote:
> Hi,
>
> On Wed, Mar 06, 2013 at 04:00:52PM +0400, Dinar Temirbulatov wrote:
>> Hi,
>> The current implementation of IPACP doesn't allowed to clone function
>> if caller(s) to that function is located in another object.
>
> That is not exactly true.  With -fipa-cp-clone (default at -O3),
> IPA-CP is happy to clone a function that is callable from outside of
> the current compilation unit.  Of course, only calls from within the
> CU are redirected without LTO.
yes, but that still would require manually preparing of CU for
selected number of objects.

> And code size may grow significantly,
> which is why IPA-CP does this only if it deems the estimated
> cost/benefit ratio to still be quite good.
>
>> Of course,
>> no such problems if we could utilized LTO. And it is very interesting
>> to have such functionality of compiler even without LTO. It could be
>> changed, if for example we could call to the cloned instance of that
>> function from the original instance of function in the function
>> prolog:
>> 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.

>
> 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.

>
> Thanks,
>
> Martin

Reply via email to