Re: [PATCH] ifcvt: improve cost estimation (PR 87047)

2019-10-01 Thread Richard Biener
On Mon, Sep 30, 2019 at 7:51 PM Alexander Monakov wrote: > > On Mon, 30 Sep 2019, Alexander Monakov wrote: > > > +static unsigned > > +average_cost (unsigned then_cost, unsigned else_cost, edge e) > > +{ > > + return else_cost + e->probability.apply ((int) then_cost - else_cost); > > Ugh, I made

Re: [PATCH] ifcvt: improve cost estimation (PR 87047)

2019-09-30 Thread Alexander Monakov
On Mon, 30 Sep 2019, Alexander Monakov wrote: > +static unsigned > +average_cost (unsigned then_cost, unsigned else_cost, edge e) > +{ > + return else_cost + e->probability.apply ((int) then_cost - else_cost); Ugh, I made a wrong last-minute edit here, we want signed cost difference so the argum

[PATCH] ifcvt: improve cost estimation (PR 87047)

2019-09-30 Thread Alexander Monakov
Hi, this patch corrects a problem where our cost estimation in if-conversion is broken when the 'else' block is missing: we then take the cost of 'then' block, which leads gcc willing to replace a conditionally-executed block with cost 80 with an unconditionally-executed block with cost 72. Exist