[llvm] 195af8e - [MemoryBuiltins] Drop ReallocLike type (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 9 02:36:11 PST 2022
Author: Nikita Popov
Date: 2022-12-09T11:35:20+01:00
New Revision: 195af8e034f08de9b620fb434a4e816c74575e86
URL: https://github.com/llvm/llvm-project/commit/195af8e034f08de9b620fb434a4e816c74575e86
DIFF: https://github.com/llvm/llvm-project/commit/195af8e034f08de9b620fb434a4e816c74575e86.diff
LOG: [MemoryBuiltins] Drop ReallocLike type (NFC)
All realloc style functions have been migrated to use allocator
attributes, so we no longer need to check for this.
Added:
Modified:
llvm/lib/Analysis/MemoryBuiltins.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
index c251f924fdf4..b205da1025f0 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -56,12 +56,11 @@ enum AllocType : uint8_t {
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,
+ StrDupLike = 1<<4,
MallocOrOpNewLike = MallocLike | OpNewLike,
MallocOrCallocLike = MallocLike | OpNewLike | CallocLike | AlignedAllocLike,
AllocLike = MallocOrCallocLike | StrDupLike,
- AnyAlloc = AllocLike | ReallocLike
+ AnyAlloc = AllocLike
};
enum class MallocFamily {
@@ -339,16 +338,11 @@ bool llvm::isAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
/// Tests if a functions is a call or invoke to a library function that
/// reallocates memory (e.g., realloc).
bool llvm::isReallocLikeFn(const Function *F, const TargetLibraryInfo *TLI) {
- return getAllocationDataForFunction(F, ReallocLike, TLI).has_value() ||
- checkFnAllocKind(F, AllocFnKind::Realloc);
+ return checkFnAllocKind(F, AllocFnKind::Realloc);
}
Value *llvm::getReallocatedOperand(const CallBase *CB,
const TargetLibraryInfo *TLI) {
- if (getAllocationData(CB, ReallocLike, TLI).has_value()) {
- // All currently supported realloc functions reallocate the first argument.
- return CB->getArgOperand(0);
- }
if (checkFnAllocKind(CB, AllocFnKind::Realloc))
return CB->getArgOperandWithAttribute(Attribute::AllocatedPointer);
return nullptr;
More information about the llvm-commits
mailing list