https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108715
--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> --- While the strlen pattern recognition has been added later than memcpy/memset, it is really the same thing. With -ffreestanding which you are supposed to use when you are providing C library yourself (or parts thereof as in this case) they aren't recognized for years. Without -ffreestanding, -fno-tree-loop-distribute-patterns turns off those pattern recognitions. As mentioned in the other PR, while disabling pattern recognition of say memcpy within function named memcpy and similarly for strlen wouldn't be that hard (where currently without any of the above options we end up with tail recursion), there is always the case where say memcpy could be implemented by calling say memcpy_impl and only that one would contain the recognized pattern. Such indirect recursion would be much harder to deal with.