diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp index c251f924fdf48e..b205da1025f02e 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;