[PATCH] D107345: Introduce LowerGCLeafIntrinsics pass

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 3 05:54:05 PDT 2021


mkazantsev created this revision.
mkazantsev added reviewers: apilipenko, anna, reames.
Herald added subscribers: jfb, hiraditya, mgorny.
mkazantsev requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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`.


https://reviews.llvm.org/D107345

Files:
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/Transforms/Scalar.h
  llvm/include/llvm/Transforms/Scalar/LowerGCLeafIntrinsics.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Scalar/CMakeLists.txt
  llvm/lib/Transforms/Scalar/LowerGCLeafIntrinsics.cpp
  llvm/lib/Transforms/Scalar/Scalar.cpp
  llvm/test/Transforms/LowerGCLeafIntrinsics/memcpy.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107345.363708.patch
Type: text/x-patch
Size: 23970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210803/4b8178b7/attachment.bin>


More information about the llvm-commits mailing list