https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114589
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- This is the "old" issue with the bogus /* If BEST_BB is at the same nesting level, then require it to have significantly lower execution frequency to avoid gratuitous movement. */ if (bb_loop_depth (best_bb) == bb_loop_depth (early_bb) /* If result of comparsion is unknown, prefer EARLY_BB. Thus use !(...>=..) rather than (...<...) */ && !(best_bb->count * 100 >= early_bb->count * threshold)) return best_bb; check. We have a BB2 count of 118111600 and BB5 we'd sink to has 105119324 which is higher than 75% of BB2. This was supposed to prevent sinking across if (x) unlikely (); blocks but it has odd side-effects like this one. IIRC there's duplicates for this. I'll note that we probably want to avoid sinking to a post-dominator unless it sinks out of a loop (that's cross-BB scheduling). But we no longer compute post-dominators. Without re-introducing those and limiting sinking this way removing the odd code will cause regressions.