From: Philip Reames Date: Tue, 18 Jan 2022 23:16:12 +0000 (-0800) Subject: Revert "[MemoryBuiltins] Demote isMallocLikeFn to implementation routine since last... X-Git-Tag: upstream/15.0.7~20020 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fcab2d1309395b01121eebca31c29d7d7a2fe317;p=platform%2Fupstream%2Fllvm.git 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. --- diff --git a/llvm/include/llvm/Analysis/MemoryBuiltins.h b/llvm/include/llvm/Analysis/MemoryBuiltins.h index d5b60ee5..858a3ed 100644 --- a/llvm/include/llvm/Analysis/MemoryBuiltins.h +++ b/llvm/include/llvm/Analysis/MemoryBuiltins.h @@ -57,6 +57,12 @@ bool isAllocationFn(const Value *V, function_ref 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 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 208f93a..af8cb78 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 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).