[llvm] f6413d8 - [Transforms] Remove getOrCreateInitFunction (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 22 06:31:02 PDT 2021


Author: Kazu Hirata
Date: 2021-07-22T06:30:39-07:00
New Revision: f6413d8aaa0205b58345bdd985d2c5c4544bd260

URL: https://github.com/llvm/llvm-project/commit/f6413d8aaa0205b58345bdd985d2c5c4544bd260
DIFF: https://github.com/llvm/llvm-project/commit/f6413d8aaa0205b58345bdd985d2c5c4544bd260.diff

LOG: [Transforms] Remove getOrCreateInitFunction (NFC)

The last use was removed on Jan 16, 2019 in commit
81101de5853b4ed64640220a086a67b16f36f153.

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/Utils/ModuleUtils.h
    llvm/lib/Transforms/Utils/ModuleUtils.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Utils/ModuleUtils.h b/llvm/include/llvm/Transforms/Utils/ModuleUtils.h
index a2de0a9d1e65a..f53ba546dc5c9 100644
--- a/llvm/include/llvm/Transforms/Utils/ModuleUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/ModuleUtils.h
@@ -68,11 +68,6 @@ std::pair<Function *, FunctionCallee> getOrCreateSanitizerCtorAndInitFunctions(
     function_ref<void(Function *, FunctionCallee)> FunctionsCreatedCallback,
     StringRef VersionCheckName = StringRef());
 
-// Creates and returns a sanitizer init function without argument if it doesn't
-// exist, and adds it to the global constructors list. Otherwise it returns the
-// existing function.
-Function *getOrCreateInitFunction(Module &M, StringRef Name);
-
 /// Rename all the anon globals in the module using a hash computed from
 /// the list of public globals in the module.
 bool nameUnamedGlobals(Module &M);

diff  --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
index 7c0316223cd6a..2aef37205c53d 100644
--- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -177,28 +177,6 @@ llvm::getOrCreateSanitizerCtorAndInitFunctions(
   return std::make_pair(Ctor, InitFunction);
 }
 
-Function *llvm::getOrCreateInitFunction(Module &M, StringRef Name) {
-  assert(!Name.empty() && "Expected init function name");
-  if (Function *F = M.getFunction(Name)) {
-    if (F->arg_size() != 0 ||
-        F->getReturnType() != Type::getVoidTy(M.getContext())) {
-      std::string Err;
-      raw_string_ostream Stream(Err);
-      Stream << "Sanitizer interface function defined with wrong type: " << *F;
-      report_fatal_error(Err);
-    }
-    return F;
-  }
-  Function *F =
-      cast<Function>(M.getOrInsertFunction(Name, AttributeList(),
-                                           Type::getVoidTy(M.getContext()))
-                         .getCallee());
-
-  appendToGlobalCtors(M, F, 0);
-
-  return F;
-}
-
 void llvm::filterDeadComdatFunctions(
     Module &M, SmallVectorImpl<Function *> &DeadComdatFunctions) {
   // Build a map from the comdat to the number of entries in that comdat we


        


More information about the llvm-commits mailing list