diff options
author | Nikita Popov <npopov@redhat.com> | 2022-12-09 11:35:20 +0100 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2022-12-09 11:35:20 +0100 |
commit | 195af8e034f08de9b620fb434a4e816c74575e86 (patch) | |
tree | f96e01e32fd169b6150a7b54322021b2a4318abf /llvm/lib/Analysis/MemoryBuiltins.cpp | |
parent | e8dfafff66b90847e37bd96491548caa6b80ab3f (diff) | |
download | llvm-195af8e034f08de9b620fb434a4e816c74575e86.zip llvm-195af8e034f08de9b620fb434a4e816c74575e86.tar.gz llvm-195af8e034f08de9b620fb434a4e816c74575e86.tar.bz2 |
[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.
Diffstat (limited to 'llvm/lib/Analysis/MemoryBuiltins.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemoryBuiltins.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp index c251f92..b205da1 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; |