https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82831

--- Comment #10 from Jan Hubicka <hubicka at ucw dot cz> ---
> > No, I disagree, the patch only papers over the problem.
> > 
> > > I wonder how we ended up with such contradictory block at the first 
> > > place?  Was
> > > it introduced by someone between the last expensive cfg cleanup and 
> > > bb-reorder?
> > 
> > Yes, that's what needs to be investigated and probably fixed.
> 
> Hi Eric.
> 
> I'm also not happy about the patch. Can you please help me with the bbro pass.
> I know you have some skill. Do you think problem is in traces how are traced
> (more precisely why are the problematic blocks selected as hot)?
> Or merging of the traces? I know it's problematic to reproduce as it happens 
> in
> profiled bootstrap, but I would appreciate any help ;)

Most likely the problem is insane profile before BBro itself.  If it is indeed
cfgcleanup with CLEANUP_EXPENSIVE needed to turn the basic block cold, I would
say any pass between last invocation and bbro might have caused the pattern
(possibly becuase the profile was nonsential even earlier).  Grepping for
it:
bb-reorder.c:  cfg_layout_initialize (CLEANUP_EXPENSIVE);
bb-reorder.c:  cleanup_cfg (CLEANUP_EXPENSIVE);
bt-load.c:        cleanup_cfg (optimize ? CLEANUP_EXPENSIVE : 0);
cfgcleanup.c:  else if (mode & CLEANUP_EXPENSIVE)
cfgcleanup.c:         if ((mode & CLEANUP_EXPENSIVE)
cfgcleanup.c:     if ((mode & CLEANUP_EXPENSIVE) && !reload_completed
cfgcleanup.c:  cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0)
function.c:  cleanup_cfg (optimize ? CLEANUP_EXPENSIVE : 0);
ifcvt.c:      cleanup_cfg (CLEANUP_EXPENSIVE);
ira.c:    cleanup_cfg (CLEANUP_EXPENSIVE);

probably last cleanup was done by rest_of_handle_thread_prologue_and_epilogue
and at that time cfgcleanup did not decided yet to do the move.

IMO turning random hot block into cold is not safe operatoin after
bbro is finished and thus Martin's patch preventing it is good.  We can indeed
track down the real cause (I plan to iterate over profile updating bugs next
week)

Honza

Reply via email to