[llvm] b3df1ce - [MemoryBuiltins] Remove unused TLI parameters (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 9 03:58:23 PST 2022
Author: Nikita Popov
Date: 2022-12-09T12:57:40+01:00
New Revision: b3df1ce389c4c3769907283bd6cde751c5e829ba
URL: https://github.com/llvm/llvm-project/commit/b3df1ce389c4c3769907283bd6cde751c5e829ba
DIFF: https://github.com/llvm/llvm-project/commit/b3df1ce389c4c3769907283bd6cde751c5e829ba.diff
LOG: [MemoryBuiltins] Remove unused TLI parameters (NFC)
Added:
Modified:
llvm/include/llvm/Analysis/MemoryBuiltins.h
llvm/lib/Analysis/MemoryBuiltins.cpp
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/lib/Transforms/Utils/BuildLibCalls.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/MemoryBuiltins.h b/llvm/include/llvm/Analysis/MemoryBuiltins.h
index 41dc0c4ff452e..bed4565fd8853 100644
--- a/llvm/include/llvm/Analysis/MemoryBuiltins.h
+++ b/llvm/include/llvm/Analysis/MemoryBuiltins.h
@@ -70,10 +70,10 @@ bool isAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI);
/// Tests if a function is a call or invoke to a library function that
/// reallocates memory (e.g., realloc).
-bool isReallocLikeFn(const Function *F, const TargetLibraryInfo *TLI);
+bool isReallocLikeFn(const Function *F);
/// If this is a call to a realloc function, return the reallocated operand.
-Value *getReallocatedOperand(const CallBase *CB, const TargetLibraryInfo *TLI);
+Value *getReallocatedOperand(const CallBase *CB);
//===----------------------------------------------------------------------===//
// free Call Utility Functions.
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
index cde29bb9eef83..3b17ea4b5a47e 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -317,12 +317,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) {
+bool llvm::isReallocLikeFn(const Function *F) {
return checkFnAllocKind(F, AllocFnKind::Realloc);
}
-Value *llvm::getReallocatedOperand(const CallBase *CB,
- const TargetLibraryInfo *TLI) {
+Value *llvm::getReallocatedOperand(const CallBase *CB) {
if (checkFnAllocKind(CB, AllocFnKind::Realloc))
return CB->getArgOperandWithAttribute(Attribute::AllocatedPointer);
return nullptr;
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 1a6c35cb53f12..e9cd4a65b06a7 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2793,7 +2793,7 @@ static bool isAllocSiteRemovable(Instruction *AI,
continue;
}
- if (getReallocatedOperand(cast<CallBase>(I), &TLI) == PI &&
+ if (getReallocatedOperand(cast<CallBase>(I)) == PI &&
getAllocationFamily(I, &TLI) == Family) {
assert(Family);
Users.emplace_back(I);
@@ -3037,7 +3037,7 @@ Instruction *InstCombinerImpl::visitFree(CallInst &FI, Value *Op) {
// realloc() entirely.
CallInst *CI = dyn_cast<CallInst>(Op);
if (CI && CI->hasOneUse())
- if (Value *ReallocatedOp = getReallocatedOperand(CI, &TLI))
+ if (Value *ReallocatedOp = getReallocatedOperand(CI))
return eraseInstFromFunction(*replaceInstUsesWith(*CI, ReallocatedOp));
// If we optimize for code size, try to move the call to free before the null
diff --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
index 1c8874069c27a..beb3351dddf14 100644
--- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
@@ -1228,7 +1228,7 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F,
}
// We have to do this step after AllocKind has been inferred on functions so
// we can reliably identify free-like and realloc-like functions.
- if (!isLibFreeFunction(&F, TheLibFunc) && !isReallocLikeFn(&F, &TLI))
+ if (!isLibFreeFunction(&F, TheLibFunc) && !isReallocLikeFn(&F))
Changed |= setDoesNotFreeMemory(F);
return Changed;
}
More information about the llvm-commits
mailing list