[PATCH] Add malloc predictor (PR middle-end/83023).

Martin Liška mliska@suse.cz
Wed Aug 1 11:28:00 GMT 2018


On 07/27/2018 02:38 PM, Marc Glisse wrote:
> On Fri, 27 Jul 2018, Martin Liška wrote:
> 
>> So answer is yes, the builtin can be then removed.
> 
> Good, thanks. While looking at how widely it is going to apply, I noticed that the default, throwing operator new has attribute malloc and everything, but the non-throwing variant declared in <new> doesn't, so it won't benefit from the new predictor. I don't know if there is a good reason for this disparity...
> 

Well in case somebody uses operator new:

     int* p1 = new int;
     if (p1)
      delete p1;

we optimize out that to if (true), even when one has used defined
operator new. Thus it's probably OK.

Martin



More information about the Gcc-patches mailing list