This patch fixes https://bugs.llvm.org//show_bug.cgi?id=31391
Last time memmove was enabled, LIR was using the memory data dependence static analysis to disambiguate the use of memmove().
Those patches were backed out because the dependence analysis is unsafe, and it still contains the same errors as of today.
This patch avoids using the static analysis, and instead versions the loop conditional to whether memmove is legal.
A next patch will add support to generate the runtime checks for memset as described in https://bugs.llvm.org//show_bug.cgi?id=31391#c4
The code of this patch mostly comes from Hexagon-LIR, and the revert of the previous revert of the memmove in LIR.
Krzysztof, we will probably need to refactor this code: Hexagon requires some special handling for volatile memcpy, and the rest is usable for target independent code.
This would not work right for if the target has memmove, but not memcpy. Maybe not an issue in practice, but still kind of confusing.