Minor style tweaks following fb93659

This commit is contained in:
Philip Reames 2022-01-10 09:32:23 -08:00
parent 0cf7e61a42
commit 1d127315e7
1 changed files with 12 additions and 9 deletions

View File

@ -255,15 +255,6 @@ bool llvm::isAlignedAllocLikeFn(
return getAllocationData(V, AlignedAllocLike, GetTLI)
.hasValue();
}
/// Gets the alignment argument for an aligned_alloc-like function
Value *llvm::getAllocAlignment(const CallBase *V,
const TargetLibraryInfo *TLI) {
const Optional<AllocFnsTy> FnData = getAllocationData(V, AnyAlloc, TLI);
if (!FnData.hasValue() || FnData->AlignParam < 0) {
return nullptr;
}
return V->getOperand(FnData->AlignParam);
}
/// Tests if a value is a call or invoke to a library function that
/// allocates zero-filled memory (such as calloc).
@ -307,6 +298,18 @@ bool llvm::isStrdupLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
return getAllocationData(V, StrDupLike, TLI).hasValue();
}
Value *llvm::getAllocAlignment(const CallBase *V,
const TargetLibraryInfo *TLI) {
assert(isAllocationFn(V, TLI));
const Optional<AllocFnsTy> FnData = getAllocationData(V, AnyAlloc, TLI);
if (!FnData.hasValue() || FnData->AlignParam < 0) {
return nullptr;
}
return V->getOperand(FnData->AlignParam);
}
Constant *llvm::getInitialValueOfAllocation(const CallBase *Alloc,
const TargetLibraryInfo *TLI,
Type *Ty) {