Skip to content

Commit b3df1ce

Browse files
committed
[MemoryBuiltins] Remove unused TLI parameters (NFC)
1 parent 9d72444 commit b3df1ce

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

llvm/include/llvm/Analysis/MemoryBuiltins.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ bool isAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI);
7070

7171
/// Tests if a function is a call or invoke to a library function that
7272
/// reallocates memory (e.g., realloc).
73-
bool isReallocLikeFn(const Function *F, const TargetLibraryInfo *TLI);
73+
bool isReallocLikeFn(const Function *F);
7474

7575
/// If this is a call to a realloc function, return the reallocated operand.
76-
Value *getReallocatedOperand(const CallBase *CB, const TargetLibraryInfo *TLI);
76+
Value *getReallocatedOperand(const CallBase *CB);
7777

7878
//===----------------------------------------------------------------------===//
7979
// free Call Utility Functions.

llvm/lib/Analysis/MemoryBuiltins.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,11 @@ bool llvm::isAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
317317

318318
/// Tests if a functions is a call or invoke to a library function that
319319
/// reallocates memory (e.g., realloc).
320-
bool llvm::isReallocLikeFn(const Function *F, const TargetLibraryInfo *TLI) {
320+
bool llvm::isReallocLikeFn(const Function *F) {
321321
return checkFnAllocKind(F, AllocFnKind::Realloc);
322322
}
323323

324-
Value *llvm::getReallocatedOperand(const CallBase *CB,
325-
const TargetLibraryInfo *TLI) {
324+
Value *llvm::getReallocatedOperand(const CallBase *CB) {
326325
if (checkFnAllocKind(CB, AllocFnKind::Realloc))
327326
return CB->getArgOperandWithAttribute(Attribute::AllocatedPointer);
328327
return nullptr;

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2793,7 +2793,7 @@ static bool isAllocSiteRemovable(Instruction *AI,
27932793
continue;
27942794
}
27952795

2796-
if (getReallocatedOperand(cast<CallBase>(I), &TLI) == PI &&
2796+
if (getReallocatedOperand(cast<CallBase>(I)) == PI &&
27972797
getAllocationFamily(I, &TLI) == Family) {
27982798
assert(Family);
27992799
Users.emplace_back(I);
@@ -3037,7 +3037,7 @@ Instruction *InstCombinerImpl::visitFree(CallInst &FI, Value *Op) {
30373037
// realloc() entirely.
30383038
CallInst *CI = dyn_cast<CallInst>(Op);
30393039
if (CI && CI->hasOneUse())
3040-
if (Value *ReallocatedOp = getReallocatedOperand(CI, &TLI))
3040+
if (Value *ReallocatedOp = getReallocatedOperand(CI))
30413041
return eraseInstFromFunction(*replaceInstUsesWith(*CI, ReallocatedOp));
30423042

30433043
// If we optimize for code size, try to move the call to free before the null

llvm/lib/Transforms/Utils/BuildLibCalls.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F,
12281228
}
12291229
// We have to do this step after AllocKind has been inferred on functions so
12301230
// we can reliably identify free-like and realloc-like functions.
1231-
if (!isLibFreeFunction(&F, TheLibFunc) && !isReallocLikeFn(&F, &TLI))
1231+
if (!isLibFreeFunction(&F, TheLibFunc) && !isReallocLikeFn(&F))
12321232
Changed |= setDoesNotFreeMemory(F);
12331233
return Changed;
12341234
}

0 commit comments

Comments
 (0)