https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66890
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Really for this loop, I would have assume to be split into 3 different loops like: volatile int count; int main() { int i; for (i = 0; i < 999; i++) { if (i == 999) count *= 2; count++; } for (; i < 999+1; i++) { if (i == 999) count *= 2; count++; } for (; i < 100000; i++) { if (i == 999) count *= 2; count++; } } And then it would not have an extra branch inside the loop itself either.