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

2018-08-07 Thread Martin Liška
On 08/07/2018 01:51 PM, Jan Hubicka wrote: >> >> 2018-07-26 Martin Liska >> >> PR middle-end/83023 >> * predict.c (expr_expected_value_1): Handle DECL_IS_MALLOC, >> BUILT_IN_REALLOC and DECL_IS_OPERATOR_NEW. >> * predict.def (PRED_MALLOC_NONNULL): New predictor. > > Pa

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

2018-08-07 Thread Jan Hubicka
> > 2018-07-26 Martin Liska > > PR middle-end/83023 > * predict.c (expr_expected_value_1): Handle DECL_IS_MALLOC, > BUILT_IN_REALLOC and DECL_IS_OPERATOR_NEW. > * predict.def (PRED_MALLOC_NONNULL): New predictor. Patch is OK. I am still somewhat worried that we wil

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

2018-08-02 Thread Martin Liška
On 08/01/2018 05:04 PM, Marc Glisse wrote: > On Wed, 1 Aug 2018, Martin Liška wrote: > >> On 08/01/2018 02:25 PM, Marc Glisse wrote: >>> On Wed, 1 Aug 2018, Martin Liška wrote: >>> On 07/27/2018 02:38 PM, Marc Glisse wrote: > On Fri, 27 Jul 2018, Martin Liška wrote: > >> So answer

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

2018-08-01 Thread Nathan Sidwell
On 08/01/2018 05:25 AM, Marc Glisse wrote: Throwing new is returns_nonnull (errors are reported with exceptions) so that's fine, but non-throwing new is not: int* p1 = new(std::nothrow) int; Here errors are reported by returning 0, so it is common to test if p1 is 0 and this is precisely the

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

2018-08-01 Thread Marc Glisse
On Wed, 1 Aug 2018, Martin Liška wrote: On 08/01/2018 02:25 PM, Marc Glisse wrote: On Wed, 1 Aug 2018, Martin Liška wrote: 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

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

2018-08-01 Thread Martin Liška
On 08/01/2018 02:25 PM, Marc Glisse wrote: > On Wed, 1 Aug 2018, Martin Liška wrote: > >> 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 goin

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

2018-08-01 Thread Marc Glisse
On Wed, 1 Aug 2018, Martin Liška wrote: 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 h

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

2018-08-01 Thread Martin Liška
On 07/31/2018 11:25 AM, Jan Hubicka wrote: >> Hi. >> >> Following patch implements new predictors that annotates malloc-like >> functions. >> These almost every time return a non-null value. >> >> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. >> >> Ready to be installe

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

2018-08-01 Thread Martin Liška
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 everythin

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

2018-08-01 Thread Martin Liška
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 everythin

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

2018-07-31 Thread Jan Hubicka
> Hi. > > Following patch implements new predictors that annotates malloc-like > functions. > These almost every time return a non-null value. > > Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. > > Ready to be installed? > Martin > > gcc/ChangeLog: > > 2018-07-26

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

2018-07-27 Thread Marc Glisse
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 doesn't

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

2018-07-27 Thread Martin Liška
On 07/26/2018 05:00 PM, Marc Glisse wrote: > On Thu, 26 Jul 2018, Martin Liška wrote: > >> Following patch implements new predictors that annotates malloc-like >> functions. >> These almost every time return a non-null value. > > Out of curiosity (the __builtin_expect there doesn't hurt and we d

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

2018-07-26 Thread Marc Glisse
On Thu, 26 Jul 2018, Martin Liška wrote: Following patch implements new predictors that annotates malloc-like functions. These almost every time return a non-null value. Out of curiosity (the __builtin_expect there doesn't hurt and we don't need to remove it), does it make __builtin_expect un