The memcmp transformation of calls used in equality tests with zero is restricted to arrays of a power-of-two alignment and size, even though the middle end is capable of emitting efficient code for arrays that don't satisfy this restriction. As a result, some memcmp calls result in less than optimal code for strictly aligned targets even with the subsequent optimization in ExpandMemCmp.cpp.
The proposed change relaxes the restriction in the simplifier, letting even calls with unaligned arrays whose size is not a power of two expand to a series of loads followed by a single comparison (up to the maximum scalar register size). This might come with a small increase in the size of the emitted code, but in my testing with targets like mips64, riscv64 and sparcv9 the increase didn't seem excessive. The change might also results in slightly different code for targets that don't penalize unaligned accesses (because it preempts the transformation in ExpandMemCmp.cpp) but based on inspection the resulting object code appears comparably optimal.