On Mon, Nov 06, 2017 at 02:47:52PM +0100, Jan Hubicka wrote: > Hi, > this patch fixes sanity checking ICE with FDO bootstrap. > The problem is when ENTRY_BLOCK_PTR count is zero and function is being > inlined we disabled scaling. This is no longer correct because scaling > also involves conversion between local and global profiles. > > Bootstrapped/regtested x86_64-linux, comitted. > > Honza > > PR bootstrap/82832 > * ipa-inline-transform.c (update_noncloned_frequencies): Always > scale. > (inline_transform): Likewise. > * predict.c (counts_to_freqs): Remove useless conditional. > * profile-count.h (profile_count::apply_scale): Move sanity check. > * tree-inline.c (copy_bb): Always scale. > (copy_cfg_body): Likewise. > Index: ipa-inline-transform.c > =================================================================== > --- ipa-inline-transform.c (revision 254411) > +++ ipa-inline-transform.c (working copy) > @@ -59,7 +59,18 @@ update_noncloned_frequencies (struct cgr > profile_count den) > { > struct cgraph_edge *e; > - bool scale = (num == profile_count::zero () || den > 0); > + > + /* We always must scale to be sure counters end up compatible. > + If den is zero, just force it nonzero and hope for reasonable > + approximation. > + When num is forced nonzero, also update den, so we do not scale profile > + to 0. */ > + if (!(num == den) > + && !(den.force_nonzero () == den))
Can't we use != here? Marek