https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81165
--- Comment #7 from Alexandre Oliva <aoliva at gcc dot gnu.org> --- it may very well be the case that it is gcc7 that's buggy in optimizing out the loop. after all, there is a divide-by-x0 in the loop entry test and, save for global optimizations, the compiler couldn't tell x0 was nonzero. looking into it...