Some of the intrinsics (such as llvm.memcpy.element.unordered.atomic) may be
lowered differently, depending on whether or not they are considered gc leaf.
Those that are gc leaves may be easily lowered on IR level according to their
semantics.
On small data pieces, it saves time on call overhead (that may be significant if
we are about to copy a small portion of data). On big data pieces, ideally the code
gen should be able to generate code not worse than any other possible lowering
for such simple cases.
Another advantage of IR lowering is that the compiler may figure out some facts
(e.g. regarding length of the copied data) and do less job than straightforward
lowering into a library call would.
This patch introduces a pass that may lower various GC leaf intrinsics on IR level,
and implements it for llvm.memcpy.element.unordered.atomic.
clang-tidy: warning: namespace 'llvm' not terminated with a closing comment [llvm-namespace-comment]
not useful
clang-format: please reformat the code