https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71403
Jan Hubicka <hubicka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> --- > We have this in cunroll: > > Loop 2 iterates at most 2 times. > Loop 2 likely iterates at most 2 times. > > Umm, no, the loop actually iterates 3 times. I don't know if it's the shape > of the CFG or something else that is confusing the iterations analysis code, > but the loop definitely iterates 3 times. Yep, the thing is that the upper bound is recorded for the inner loop already at thread time: loop_2 (header = 10, latch = 9, niter = , upper_bound = 2, likely_upper_bound = 2) this is correct but when you collapse the two loops together, this is no longer the case. Loop updating code however choses to kill loop 1: fix_loop_structure: fixing up loops for function fix_loop_structure: removing loop 1 and the loop2 which survives has the iteration count estimate attached. At some point we need to figure out that the collapsed loop is not really one of the original loops and either update the info accordingly or throw it away. Honza