LLVM can do various optimizations around standard library memcpy and memmove
intrinsics. In particular we have LoopIdionRecognize and MemCpyOptimizer passes
which do a bunch of interesting transformations.
Some languages require from all of their memory accesses to be unordered
atomics (like Java for example). Which means that we can't directly use above
mentioned passes when compiling for such language.
This change is a step towards supporting this optimizations for languages with
atomicity constraints. It adds special versions of the memcpy and memmove intrinsics
which are specified to have predictable set of atomic memory accesses. They are
lowered to call to the library functions and it's target responsibility to
implement them.
Following changes will be able to extend LoopIdionRecognize and other passes
to support newly added intrinsics.