https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71403
Jeffrey A. Law <law at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |law at redhat dot com --- Comment #2 from Jeffrey A. Law <law at redhat dot com> --- So we start with 3 nested loops. Let's call them the A, D, and B loops. Trivial examination shows the B loop never loops. It's a total nop. The A loop iterates twice. On the first iteration of the A loop, the D loop will iterate twice (ignore for now that the D loop just increases D and has no other side effects). The A & D loops get collapsed into a single loop via a series of transformations. That collapsed loop iterates twice incrementing the value of D to 2. There's another iteration which increments the value of A (but does not modify D). Then A increments again and we exit. The latch edge is traversed *3* times. All is fine and good. 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.