It's probably related to wrapping. If you iterate with step n and limit m and m is big enough, at some point i+n>m.max and will wrap, and the cycle will continue. The optimizer might check that it can't happen, but apparently doesn't.