[PATCH] D69623: Allow overriding bzero libcall from command line

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 09:33:59 PDT 2019


gchatelet created this revision.
gchatelet added a reviewer: courbet.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

`bzero` libcall is disabled except on Darwin version 10+.
This patch enables the use of bzero (especially on X86 when zeroing out memory) when user can provide a fast implementation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69623

Files:
  llvm/lib/CodeGen/TargetLoweringBase.cpp


Index: llvm/lib/CodeGen/TargetLoweringBase.cpp
===================================================================
--- llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -88,6 +88,11 @@
     cl::desc("Minimum density for building a jump table in "
              "an optsize function"));
 
+/// Allow overriding bzero libcall
+cl::opt<std::string>
+    OverrideBzeroLibcall("override-libcall-bzero",
+                         cl::desc("The function name for bzero"), cl::Hidden);
+
 static bool darwinHasSinCos(const Triple &TT) {
   assert(TT.isOSDarwin() && "should be called with darwin triple");
   // Don't bother with 32 bit x86.
@@ -206,6 +211,9 @@
   if (TT.isOSOpenBSD()) {
     setLibcallName(RTLIB::STACKPROTECTOR_CHECK_FAIL, nullptr);
   }
+
+  if (!OverrideBzeroLibcall.empty())
+    setLibcallName(RTLIB::BZERO, OverrideBzeroLibcall.data());
 }
 
 /// getFPEXT - Return the FPEXT_*_* value for the given types, or


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69623.227128.patch
Type: text/x-patch
Size: 963 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191030/af936cb4/attachment.bin>


More information about the llvm-commits mailing list