[llvm] d98dfb2 - [instcombine Use reference for never-null pointer in isAllocSiteRemovable [nfc]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 16 12:03:49 PST 2021
Author: Philip Reames
Date: 2021-12-16T12:03:42-08:00
New Revision: d98dfb2baabb647a6ac4c4f4399999cfc44433db
URL: https://github.com/llvm/llvm-project/commit/d98dfb2baabb647a6ac4c4f4399999cfc44433db
DIFF: https://github.com/llvm/llvm-project/commit/d98dfb2baabb647a6ac4c4f4399999cfc44433db.diff
LOG: [instcombine Use reference for never-null pointer in isAllocSiteRemovable [nfc]
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index a797d5b05deb..ef6a62296889 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2546,7 +2546,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
return nullptr;
}
-static bool isNeverEqualToUnescapedAlloc(Value *V, const TargetLibraryInfo *TLI,
+static bool isNeverEqualToUnescapedAlloc(Value *V, const TargetLibraryInfo &TLI,
Instruction *AI) {
if (isa<ConstantPointerNull>(V))
return true;
@@ -2557,7 +2557,7 @@ static bool isNeverEqualToUnescapedAlloc(Value *V, const TargetLibraryInfo *TLI,
// through bitcasts of V can cause
// the result statement below to be true, even when AI and V (ex:
// i8* ->i32* ->i8* of AI) are the same allocations.
- return isAllocLikeFn(V, TLI) && V != AI;
+ return isAllocLikeFn(V, &TLI) && V != AI;
}
/// Given a call CB which uses an address UsedV, return true if we can prove the
@@ -2598,7 +2598,7 @@ static bool isRemovableWrite(CallBase &CB, Value *UsedV) {
static bool isAllocSiteRemovable(Instruction *AI,
SmallVectorImpl<WeakTrackingVH> &Users,
- const TargetLibraryInfo *TLI) {
+ const TargetLibraryInfo &TLI) {
SmallVector<Instruction*, 4> Worklist;
Worklist.push_back(AI);
@@ -2668,12 +2668,12 @@ static bool isAllocSiteRemovable(Instruction *AI,
continue;
}
- if (isFreeCall(I, TLI)) {
+ if (isFreeCall(I, &TLI)) {
Users.emplace_back(I);
continue;
}
- if (isReallocLikeFn(I, TLI, true)) {
+ if (isReallocLikeFn(I, &TLI, true)) {
Users.emplace_back(I);
Worklist.push_back(I);
continue;
@@ -2717,7 +2717,7 @@ Instruction *InstCombinerImpl::visitAllocSite(Instruction &MI) {
DIB.reset(new DIBuilder(*MI.getModule(), /*AllowUnresolved=*/false));
}
- if (isAllocSiteRemovable(&MI, Users, &TLI)) {
+ if (isAllocSiteRemovable(&MI, Users, TLI)) {
for (unsigned i = 0, e = Users.size(); i != e; ++i) {
// Lowering all @llvm.objectsize calls first because they may
// use a bitcast/GEP of the alloca we are removing.
More information about the llvm-commits
mailing list