[PATCH] D86025: [CodeGen] Respect libfunc availability when lowering intrinsic memcpy

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 13:05:41 PDT 2020


arsenm requested changes to this revision.
arsenm added a comment.
This revision now requires changes to proceed.
Herald added a subscriber: wdng.

The memcpy intrinsic has nothing to do with library availability, and handling it should not depend on the library function. The backend may choose to emit a libcall for it, but this is not required (e.g. AMDGPU has no libcalls whatsoever). GlobalISel should be able to handle arbitrary memcpys with ease since it's possible to emit a loop. With SelectionDAG you have to expand the arbitrary case in the IR, but it still handles constant size cases.



================
Comment at: llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp:1787
+  if (ID == Intrinsic::memcpy && !LibInfo->has(LibFunc_memcpy))
+    return false;
   if (translateKnownIntrinsic(CI, ID, MIRBuilder))
----------------
This needs to be dropped. D85199 switches these to using proper legalizeable instructions. It may make more sense for the libcall action to fail if the libraryinfo does not have memcpy


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86025/new/

https://reviews.llvm.org/D86025



More information about the llvm-commits mailing list