[MemCpyOpt] Allow variable lengths in memcpy optimizer

Authored by ollef on Apr 21 2021, 1:48 PM.


[MemCpyOpt] Allow variable lengths in memcpy optimizer

This makes the memcpy-memcpy and memcpy-memset optimizations work for
variable sizes as long as they are equal, relaxing the old restriction
that they are constant integers. If they're not equal, the old
requirement that they are constant integers with certain size
restrictions is used.

The implementation works by pushing the length tests further down in the
code, which reveals some places where it's enough that the lengths are
equal (but not necessarily constant).

Differential Revision: https://reviews.llvm.org/D100870