This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Reorgnanization of profile count maintenance code, part 1
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 6 Jun 2017 22:25:29 +0200
- Subject: Re: Reorgnanization of profile count maintenance code, part 1
- Authentication-results: sourceware.org; auth=none
- References: <20170601113556.GH22051@kam.mff.cuni.cz> <20170606163122.GF19687@gate.crashing.org>
> Hi!
>
> On Thu, Jun 01, 2017 at 01:35:56PM +0200, Jan Hubicka wrote:
> > + /* FIXME: shrink wrapping violates this sanity check. */
> > + gcc_checking_assert ((num >= 0
> > + && (num <= REG_BR_PROB_BASE
> > + || den <= REG_BR_PROB_BASE)
> > + && den > 0) || 1);
> > + ret.m_val = RDIV (m_val * num, den);
> > + return ret;
>
> Sorry if I missed this... But where/how does it violate this?
It sums multiple probabilties together and overflows the limit.
>
> > + /* Take care for overflows! */
> > + if (num.m_val < 8196 || m_val < 8196)
> > + ret.m_val = RDIV (m_val * num.m_val, den.m_val);
> > + else
> > + ret.m_val = RDIV (m_val * RDIV (num.m_val * 8196, den.m_val), 8196);
> > + return ret;
>
> 8196 is a strange number, did you mean 8192?
Yep I meant :) Not sure how it got there.
I will fix both problems incrementally.
Thanks,
Honza
>
>
> Segher