Revert "[MemoryBuiltins] Demote isMallocLikeFn to implementation routine since last...
authorPhilip Reames <listmail@philipreames.com>
Tue, 18 Jan 2022 23:16:12 +0000 (15:16 -0800)
committerPhilip Reames <listmail@philipreames.com>
Tue, 18 Jan 2022 23:16:12 +0000 (15:16 -0800)
This reverts commit 167af7bbfe2d6e969c409b0cbe1af560b2b39e8f. Buildbot breaks since I forgot to remove a unit test.

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

index d5b60ee..858a3ed 100644 (file)
@@ -57,6 +57,12 @@ 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);
 
index 208f93a..af8cb78 100644 (file)
@@ -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).