[llvm] [llvm] Remove unused local variables (NFC) (PR #167106)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 7 23:40:19 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/167106
Identified with bugprone-unused-local-non-trivial-variable.
>From 55945aaf0badcce4037dd081a857fdaed4d4cab9 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 6 Nov 2025 08:02:25 -0800
Subject: [PATCH] [llvm] Remove unused local variables (NFC)
Identified with bugprone-unused-local-non-trivial-variable.
---
llvm/lib/CAS/UnifiedOnDiskCache.cpp | 2 --
llvm/lib/CodeGen/WindowsSecureHotPatching.cpp | 2 --
llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp | 1 -
llvm/lib/Transforms/IPO/SampleProfile.cpp | 1 -
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 2 --
5 files changed, 8 deletions(-)
diff --git a/llvm/lib/CAS/UnifiedOnDiskCache.cpp b/llvm/lib/CAS/UnifiedOnDiskCache.cpp
index 7b790bb005ce9..e6b676accb0fe 100644
--- a/llvm/lib/CAS/UnifiedOnDiskCache.cpp
+++ b/llvm/lib/CAS/UnifiedOnDiskCache.cpp
@@ -331,8 +331,6 @@ Expected<ValidationResult> UnifiedOnDiskCache::validateIfNeeded(
if (Error E = getBootTime().moveInto(BootTime))
return std::move(E);
- std::string LogValidationError;
-
if (ValidationBootTime == BootTime && !ForceValidation)
return ValidationResult::Skipped;
diff --git a/llvm/lib/CodeGen/WindowsSecureHotPatching.cpp b/llvm/lib/CodeGen/WindowsSecureHotPatching.cpp
index fd54190b04468..dab1416d254a2 100644
--- a/llvm/lib/CodeGen/WindowsSecureHotPatching.cpp
+++ b/llvm/lib/CodeGen/WindowsSecureHotPatching.cpp
@@ -461,8 +461,6 @@ static bool searchConstantExprForGlobalVariables(
Value *V, SmallDenseMap<GlobalVariable *, Value *> &GVLoadMap,
SmallVector<GlobalVariableUse> &GVUses) {
- SmallVector<Value *, 8> ReplacedOperands;
-
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
if (globalVariableNeedsRedirect(GV)) {
GVLoadMap[GV] = nullptr;
diff --git a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
index 597d311989b2f..1719165fb6717 100644
--- a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
+++ b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
@@ -1051,7 +1051,6 @@ bool LowOverheadLoop::ValidateLiveOuts() {
// check where it gets its false lanes from, if any.
int InactiveIdx = findVPTInactiveOperandIdx(*MI);
if (InactiveIdx != -1) {
- SmallPtrSet<MachineInstr *, 2> Defs;
MachineInstr *FalseSrc = RDI.getUniqueReachingMIDef(
MI, MI->getOperand(InactiveIdx).getReg());
if (FalseSrc) {
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index e39e311dd795f..bd74388aaf217 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -2293,7 +2293,6 @@ bool SampleProfileLoader::runOnFunction(Function &F,
// count value.
if (!F.getEntryCount())
F.setEntryCount(ProfileCount(initialEntryCount, Function::PCT_Real));
- std::unique_ptr<OptimizationRemarkEmitter> OwnedORE;
auto &FAM = AM.getResult<FunctionAnalysisManagerModuleProxy>(*F.getParent())
.getManager();
ORE = &FAM.getResult<OptimizationRemarkEmitterAnalysis>(F);
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index df835a077f2a0..c27d1ac99dd80 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -5368,7 +5368,6 @@ class BoUpSLP {
Lane = P.first->ReorderIndices[Lane];
assert(Lane < static_cast<int>(P.first->Scalars.size()) &&
"Couldn't find extract lane");
- SmallVector<unsigned> OpIndices;
for (unsigned OpIdx :
seq<unsigned>(::getNumberOfPotentiallyCommutativeOps(
P.first->getMainOp()))) {
@@ -8815,7 +8814,6 @@ void BoUpSLP::buildExternalUses(
const ExtraValueToDebugLocsMap &ExternallyUsedValues) {
const size_t NumVectScalars = ScalarToTreeEntries.size() + 1;
DenseMap<Value *, unsigned> ScalarToExtUses;
- SmallPtrSet<Value *, 4> ExternalUsers;
// Collect the values that we need to extract from the tree.
for (auto &TEPtr : VectorizableTree) {
TreeEntry *Entry = TEPtr.get();
More information about the llvm-commits
mailing list