http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58715
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Here is a testcase which shows we are not doing some other loop opt due to not changing the loop: typedef __SIZE_TYPE__ size_t; void f(int mlen, unsigned char *dst, size_t d_len, unsigned char *cpy) { unsigned char *d_end = dst + d_len; while (--mlen >= 0 && dst < d_end) *dst++ = 0; } This should produce memset but we are not currently.