[llvm] fcab2d1 - Revert "[MemoryBuiltins] Demote isMallocLikeFn to implementation routine since last use has been removed"

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 18 15:16:39 PST 2022


Author: Philip Reames
Date: 2022-01-18T15:16:12-08:00
New Revision: fcab2d1309395b01121eebca31c29d7d7a2fe317

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

LOG: Revert "[MemoryBuiltins] Demote isMallocLikeFn to implementation routine since last use has been removed"

This reverts commit 167af7bbfe2d6e969c409b0cbe1af560b2b39e8f. Buildbot breaks since I forgot to remove a unit test.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/MemoryBuiltins.h
    llvm/lib/Analysis/MemoryBuiltins.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/MemoryBuiltins.h b/llvm/include/llvm/Analysis/MemoryBuiltins.h
index d5b60ee540e06..858a3eddca387 100644
--- a/llvm/include/llvm/Analysis/MemoryBuiltins.h
+++ b/llvm/include/llvm/Analysis/MemoryBuiltins.h
@@ -56,6 +56,12 @@ bool isAllocationFn(const Value *V, const TargetLibraryInfo *TLI);
 bool isAllocationFn(const Value *V,
                     function_ref<const TargetLibraryInfo &(Function &)> GetTLI);
 
+/// Tests if a value is a call or invoke to a library function that
+/// allocates uninitialized memory (such as malloc).
+bool isMallocLikeFn(const Value *V, const TargetLibraryInfo *TLI);
+bool isMallocLikeFn(const Value *V,
+                    function_ref<const TargetLibraryInfo &(Function &)> GetTLI);
+
 /// Tests if a value is a call or invoke to a library function that
 /// allocates memory similar to malloc or calloc.
 bool isMallocOrCallocLikeFn(const Value *V, const TargetLibraryInfo *TLI);

diff  --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
index 208f93aa1ac63..af8cb78b9a567 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -236,9 +236,14 @@ bool llvm::isAllocationFn(
 
 /// Tests if a value is a call or invoke to a library function that
 /// allocates uninitialized memory (such as malloc).
-static bool isMallocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
+bool llvm::isMallocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
   return getAllocationData(V, MallocOrOpNewLike, TLI).hasValue();
 }
+bool llvm::isMallocLikeFn(
+    const Value *V, function_ref<const TargetLibraryInfo &(Function &)> GetTLI) {
+  return getAllocationData(V, MallocOrOpNewLike, GetTLI)
+      .hasValue();
+}
 
 /// Tests if a value is a call or invoke to a library function that
 /// allocates uninitialized memory with alignment (such as aligned_alloc).


        


More information about the llvm-commits mailing list