Skip to content

Commit

Permalink
[MemoryBuiltins] Demote isCallocLikeFn and isAlignedAllocLikeFn to lo…
Browse files Browse the repository at this point in the history
…cal helpers after removal of last external use [NFC]
  • Loading branch information
preames committed Jan 13, 2022
1 parent e289561 commit ee02cf0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
8 changes: 0 additions & 8 deletions llvm/include/llvm/Analysis/MemoryBuiltins.h
Expand Up @@ -62,14 +62,6 @@ 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 uninitialized memory with alignment (such as aligned_alloc).
bool isAlignedAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI);

/// Tests if a value is a call or invoke to a library function that
/// allocates zero-filled memory (such as calloc).
bool isCallocLikeFn(const Value *V, const TargetLibraryInfo *TLI);

/// 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);
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Analysis/MemoryBuiltins.cpp
Expand Up @@ -247,14 +247,14 @@ bool llvm::isMallocLikeFn(

/// Tests if a value is a call or invoke to a library function that
/// allocates uninitialized memory with alignment (such as aligned_alloc).
bool llvm::isAlignedAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
static bool isAlignedAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
return getAllocationData(V, AlignedAllocLike, TLI)
.hasValue();
}

/// Tests if a value is a call or invoke to a library function that
/// allocates zero-filled memory (such as calloc).
bool llvm::isCallocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
static bool isCallocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
return getAllocationData(V, CallocLike, TLI).hasValue();
}

Expand Down
1 change: 0 additions & 1 deletion llvm/unittests/Analysis/MemoryBuiltinsTest.cpp
Expand Up @@ -37,7 +37,6 @@ TEST(AllocSize, AllocationBuiltinsTest) {

const TargetLibraryInfo *TLI = nullptr;
EXPECT_FALSE(isMallocLikeFn(Caller.get(), TLI));
EXPECT_FALSE(isCallocLikeFn(Caller.get(), TLI));
EXPECT_FALSE(isAllocLikeFn(Caller.get(), TLI));

// FIXME: We might be able to treat allocsize functions as general allocation
Expand Down

0 comments on commit ee02cf0

Please sign in to comment.