[llvm] cd36b29 - [MemoryBuiltins] (Slightly) clean up abuse of MallocLike bitmask [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 13 12:39:46 PST 2022
Author: Philip Reames
Date: 2022-01-13T12:39:22-08:00
New Revision: cd36b29ec75469a0e424bdf4003e5b718252bacd
URL: https://github.com/llvm/llvm-project/commit/cd36b29ec75469a0e424bdf4003e5b718252bacd
DIFF: https://github.com/llvm/llvm-project/commit/cd36b29ec75469a0e424bdf4003e5b718252bacd.diff
LOG: [MemoryBuiltins] (Slightly) clean up abuse of MallocLike bitmask [NFC]
Added:
Modified:
llvm/lib/Analysis/MemoryBuiltins.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
index e8389c7f50d3f..d667bb8728648 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -51,12 +51,13 @@ using namespace llvm;
enum AllocType : uint8_t {
OpNewLike = 1<<0, // allocates; never returns null
- MallocLike = 1<<1 | OpNewLike, // allocates; may return null
+ MallocLike = 1<<1, // allocates; may return null
AlignedAllocLike = 1<<2, // allocates with alignment; may return null
CallocLike = 1<<3, // allocates + bzero
ReallocLike = 1<<4, // reallocates
StrDupLike = 1<<5,
- MallocOrCallocLike = MallocLike | CallocLike | AlignedAllocLike,
+ MallocOrOpNewLike = MallocLike | OpNewLike,
+ MallocOrCallocLike = MallocLike | OpNewLike | CallocLike | AlignedAllocLike,
AllocLike = MallocOrCallocLike | StrDupLike,
AnyAlloc = AllocLike | ReallocLike
};
@@ -236,11 +237,11 @@ 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) {
- return getAllocationData(V, MallocLike, TLI).hasValue();
+ return getAllocationData(V, MallocOrOpNewLike, TLI).hasValue();
}
bool llvm::isMallocLikeFn(
const Value *V, function_ref<const TargetLibraryInfo &(Function &)> GetTLI) {
- return getAllocationData(V, MallocLike, GetTLI)
+ return getAllocationData(V, MallocOrOpNewLike, GetTLI)
.hasValue();
}
More information about the llvm-commits
mailing list