From: Segher Boessenkool <segher@kernel.crashing.org>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: Reorgnanization of profile count maintenance code, part 1
Date: Wed, 07 Jun 2017 21:41:00 -0000 [thread overview]
Message-ID: <20170607214133.GJ19687@gate.crashing.org> (raw)
In-Reply-To: <20170607211108.GB30427@atrey.karlin.mff.cuni.cz>
On Wed, Jun 07, 2017 at 11:11:08PM +0200, Jan Hubicka wrote:
> > On Tue, Jun 06, 2017 at 10:25:29PM +0200, Jan Hubicka wrote:
> > > > 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.
> >
> > Ah. Yes, the scale it uses (num/den in shrink-wrap.c:924) isn't a
> > probability: it's a just a fraction, but also <= 1. The calculation cannot
> > overflow, not while there are at most 4G incoming edges to a BB.
>
> Problem is that when you multiply count by it, the buffer is considerably
> smaller, because count itself can be quite large number...
Oh duh, I stupidly looked at the frequency thing, not the count thing.
> It is not too bad - I added the sanity check mostly to see if there
> is a safe cap on num so I do not need to worry about overflows at all.
For count we can round a bit without causing problems, I think? No
such luxury with frequency, but, that's not the issue here :-)
Segher
next prev parent reply other threads:[~2017-06-07 21:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-01 11:36 Jan Hubicka
2017-06-03 18:51 ` Bernhard Reutner-Fischer
2017-06-04 17:21 ` Jan Hubicka
2017-06-05 15:13 ` Joseph Myers
2017-06-05 15:16 ` Jan Hubicka
2017-06-05 15:37 ` Jan Hubicka
2017-06-05 18:38 ` Andrew Pinski
2017-06-06 5:57 ` Jason Merrill
2017-06-06 8:00 ` Jan Hubicka
2017-06-08 16:57 ` Jason Merrill
2017-06-09 7:52 ` Jan Hubicka
2017-06-06 16:31 ` Segher Boessenkool
2017-06-06 20:25 ` Jan Hubicka
2017-06-07 18:44 ` Segher Boessenkool
2017-06-07 21:11 ` Jan Hubicka
2017-06-07 21:41 ` Segher Boessenkool [this message]
2017-06-05 18:52 Dominique d'Humières
2017-06-05 19:14 ` Jan Hubicka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170607214133.GJ19687@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).