[llvm] 215bd46 - [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:24:58 PST 2022
Author: Philip Reames
Date: 2022-01-18T15:24:52-08:00
New Revision: 215bd469058e04f464f451c658b98d60e004d728
URL: https://github.com/llvm/llvm-project/commit/215bd469058e04f464f451c658b98d60e004d728
DIFF: https://github.com/llvm/llvm-project/commit/215bd469058e04f464f451c658b98d60e004d728.diff
LOG: [MemoryBuiltins] Demote isMallocLikeFn to implementation routine since last use has been removed
Try 2, this time including the test.
Added:
Modified:
llvm/include/llvm/Analysis/MemoryBuiltins.h
llvm/lib/Analysis/MemoryBuiltins.cpp
llvm/unittests/Analysis/MemoryBuiltinsTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/MemoryBuiltins.h b/llvm/include/llvm/Analysis/MemoryBuiltins.h
index 858a3eddca387..d5b60ee540e06 100644
--- a/llvm/include/llvm/Analysis/MemoryBuiltins.h
+++ b/llvm/include/llvm/Analysis/MemoryBuiltins.h
@@ -56,12 +56,6 @@ 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 af8cb78b9a567..208f93aa1ac63 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -236,14 +236,9 @@ bool llvm::isAllocationFn(
/// Tests if a value is a call or invoke to a library function that
/// allocates uninitialized memory (such as malloc).
-bool llvm::isMallocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
+static bool 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).
diff --git a/llvm/unittests/Analysis/MemoryBuiltinsTest.cpp b/llvm/unittests/Analysis/MemoryBuiltinsTest.cpp
index 9c8e391302afe..7e22686471782 100644
--- a/llvm/unittests/Analysis/MemoryBuiltinsTest.cpp
+++ b/llvm/unittests/Analysis/MemoryBuiltinsTest.cpp
@@ -36,7 +36,6 @@ TEST(AllocSize, AllocationBuiltinsTest) {
CallInst::Create(AllocSizeFn, {ConstantInt::get(ArgTy, 100)}));
const TargetLibraryInfo *TLI = nullptr;
- EXPECT_FALSE(isMallocLikeFn(Caller.get(), TLI));
EXPECT_FALSE(isAllocLikeFn(Caller.get(), TLI));
// FIXME: We might be able to treat allocsize functions as general allocation
More information about the llvm-commits
mailing list