[llvm] [llvm] Remove unused local variables (NFC) (PR #138454)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun May 4 08:45:49 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/138454
None
>From 2c2964a6b034353c0a6ba9bb1df7d1213ddcc032 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 4 May 2025 08:40:21 -0700
Subject: [PATCH] [llvm] Remove unused local variables (NFC)
---
llvm/include/llvm/CodeGen/SDPatternMatch.h | 1 -
llvm/include/llvm/Support/GenericLoopInfoImpl.h | 2 +-
llvm/lib/Analysis/BranchProbabilityInfo.cpp | 1 -
llvm/lib/Analysis/LoopAccessAnalysis.cpp | 3 ---
llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 2 --
llvm/lib/ExecutionEngine/Orc/GetDylibInterface.cpp | 1 -
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | 4 +---
llvm/lib/IR/SafepointIRVerifier.cpp | 1 -
llvm/lib/ObjCopy/CommonConfig.cpp | 1 -
llvm/lib/ProfileData/InstrProf.cpp | 1 -
llvm/tools/dsymutil/DwarfLinkerForBinary.cpp | 2 --
llvm/tools/llvm-exegesis/lib/ParallelSnippetGenerator.cpp | 1 -
llvm/unittests/Analysis/MemorySSATest.cpp | 1 -
llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp | 2 --
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp | 2 --
llvm/unittests/IR/DominatorTreeTest.cpp | 1 -
llvm/unittests/Support/Path.cpp | 3 ---
17 files changed, 2 insertions(+), 27 deletions(-)
diff --git a/llvm/include/llvm/CodeGen/SDPatternMatch.h b/llvm/include/llvm/CodeGen/SDPatternMatch.h
index 9532be67c92e1..7a5e29bc7b138 100644
--- a/llvm/include/llvm/CodeGen/SDPatternMatch.h
+++ b/llvm/include/llvm/CodeGen/SDPatternMatch.h
@@ -1156,7 +1156,6 @@ template <typename... PatternTs> struct ReassociatableOpc_match {
// std::get<J>(Patterns)) == true
std::array<SmallBitVector, NumPatterns> Matches;
for (size_t I = 0; I != NumPatterns; I++) {
- SmallVector<bool> MatchResults;
std::apply(
[&](auto &...P) {
(Matches[I].push_back(sd_context_match(Leaves[I], Ctx, P)), ...);
diff --git a/llvm/include/llvm/Support/GenericLoopInfoImpl.h b/llvm/include/llvm/Support/GenericLoopInfoImpl.h
index 35eecd340d7d0..dd5d805544eaa 100644
--- a/llvm/include/llvm/Support/GenericLoopInfoImpl.h
+++ b/llvm/include/llvm/Support/GenericLoopInfoImpl.h
@@ -604,7 +604,7 @@ void LoopInfoBase<BlockT, LoopT>::analyze(const DomTreeBase<BlockT> &DomTree) {
template <class BlockT, class LoopT>
SmallVector<LoopT *, 4>
LoopInfoBase<BlockT, LoopT>::getLoopsInPreorder() const {
- SmallVector<LoopT *, 4> PreOrderLoops, PreOrderWorklist;
+ SmallVector<LoopT *, 4> PreOrderLoops;
// The outer-most loop actually goes into the result in the same relative
// order as we walk it. But LoopInfo stores the top level loops in reverse
// program order so for here we reverse it to get forward program order.
diff --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp
index 71c7319d98473..0ff16dbec24e0 100644
--- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp
+++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp
@@ -666,7 +666,6 @@ BranchProbabilityInfo::getEstimatedEdgeWeight(const LoopEdge &Edge) const {
template <class IterT>
std::optional<uint32_t> BranchProbabilityInfo::getMaxEstimatedEdgeWeight(
const LoopBlock &SrcLoopBB, iterator_range<IterT> Successors) const {
- SmallVector<uint32_t, 4> Weights;
std::optional<uint32_t> MaxWeight;
for (const BasicBlock *DstBB : Successors) {
const LoopBlock DstLoopBB = getLoopBlock(DstBB);
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index c65bb8be8b996..7ec9bdb318ffb 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -1426,9 +1426,6 @@ void AccessAnalysis::processMemAccesses() {
// Create sets of pointers connected by a shared alias set and
// underlying object.
- typedef SmallVector<const Value *, 16> ValueVector;
- ValueVector TempObjects;
-
SmallVector<const Value *, 16> &UOs = UnderlyingObjects[Ptr];
UOs = {};
::getUnderlyingObjects(Ptr, UOs, LI);
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 1661e28737a3d..4074ed65885c7 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3997,8 +3997,6 @@ Error BitcodeReader::rememberAndSkipFunctionBodies() {
// finished the parse greedily.
assert(SeenValueSymbolTable);
- SmallVector<uint64_t, 64> Record;
-
while (true) {
Expected<llvm::BitstreamEntry> MaybeEntry = Stream.advance();
if (!MaybeEntry)
diff --git a/llvm/lib/ExecutionEngine/Orc/GetDylibInterface.cpp b/llvm/lib/ExecutionEngine/Orc/GetDylibInterface.cpp
index 2ab90c963af9a..c80ec76868904 100644
--- a/llvm/lib/ExecutionEngine/Orc/GetDylibInterface.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/GetDylibInterface.cpp
@@ -111,7 +111,6 @@ Expected<SymbolNameSet> getDylibInterface(ExecutionSession &ES, Twine Path) {
if (auto EC = identify_magic(Path, Magic))
return createFileError(Path, EC);
- SymbolNameSet Symbols;
switch (Magic) {
case file_magic::macho_universal_binary:
case file_magic::macho_dynamically_linked_shared_lib:
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index 06dc1184e7cf5..6126cd4403b69 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -4607,8 +4607,6 @@ OpenMPIRBuilder::applyWorkshareLoopTarget(DebugLoc DL, CanonicalLoopInfo *CLI,
SmallPtrSet<BasicBlock *, 32> ParallelRegionBlockSet;
SmallVector<BasicBlock *, 32> Blocks;
OI.collectBlocks(ParallelRegionBlockSet, Blocks);
- SmallVector<BasicBlock *, 32> BlocksT(ParallelRegionBlockSet.begin(),
- ParallelRegionBlockSet.end());
CodeExtractorAnalysisCache CEAC(*OuterFn);
CodeExtractor Extractor(Blocks,
@@ -4624,7 +4622,7 @@ OpenMPIRBuilder::applyWorkshareLoopTarget(DebugLoc DL, CanonicalLoopInfo *CLI,
/* AggrArgsIn0AddrSpace */ true);
BasicBlock *CommonExit = nullptr;
- SetVector<Value *> Inputs, Outputs, SinkingCands, HoistingCands;
+ SetVector<Value *> SinkingCands, HoistingCands;
// Find allocas outside the loop body region which are used inside loop
// body
diff --git a/llvm/lib/IR/SafepointIRVerifier.cpp b/llvm/lib/IR/SafepointIRVerifier.cpp
index 09eab3d19b4d0..e54894c1e9274 100644
--- a/llvm/lib/IR/SafepointIRVerifier.cpp
+++ b/llvm/lib/IR/SafepointIRVerifier.cpp
@@ -157,7 +157,6 @@ class CFGDeadness {
protected:
void addDeadBlock(const BasicBlock *BB) {
SmallVector<const BasicBlock *, 4> NewDead;
- SmallSetVector<const BasicBlock *, 4> DF;
NewDead.push_back(BB);
while (!NewDead.empty()) {
diff --git a/llvm/lib/ObjCopy/CommonConfig.cpp b/llvm/lib/ObjCopy/CommonConfig.cpp
index ff3cb4d44c126..1da0240189293 100644
--- a/llvm/lib/ObjCopy/CommonConfig.cpp
+++ b/llvm/lib/ObjCopy/CommonConfig.cpp
@@ -19,7 +19,6 @@ NameOrPattern::create(StringRef Pattern, MatchStyle MS,
case MatchStyle::Literal:
return NameOrPattern(Pattern);
case MatchStyle::Wildcard: {
- SmallVector<char, 32> Data;
bool IsPositiveMatch = !Pattern.consume_front("!");
Expected<GlobPattern> GlobOrErr = GlobPattern::create(Pattern);
diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp
index b738d9d0eb2ce..76e8ca6a67590 100644
--- a/llvm/lib/ProfileData/InstrProf.cpp
+++ b/llvm/lib/ProfileData/InstrProf.cpp
@@ -537,7 +537,6 @@ Error InstrProfSymtab::create(Module &M, bool InLTO, bool AddCanonical) {
return E;
}
- SmallVector<MDNode *, 2> Types;
for (GlobalVariable &G : M.globals()) {
if (!G.hasName() || !G.hasMetadata(LLVMContext::MD_type))
continue;
diff --git a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
index c8fa4dbeffb9e..9bcc479f9bef5 100644
--- a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
+++ b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
@@ -202,7 +202,6 @@ Error DwarfLinkerForBinary::emitRelocations(
Obj.OutRelocs->addValidRelocs(RM);
}
- SmallString<128> InputPath;
SmallString<128> Path;
// Create the "Relocations" directory in the "Resources" directory, and
// create an architecture-specific directory in the "Relocations" directory.
@@ -233,7 +232,6 @@ static Error emitRemarks(const LinkOptions &Options, StringRef BinaryPath,
if (RL.empty())
return Error::success();
- SmallString<128> InputPath;
SmallString<128> Path;
// Create the "Remarks" directory in the "Resources" directory.
sys::path::append(Path, *Options.ResourceDir, "Remarks");
diff --git a/llvm/tools/llvm-exegesis/lib/ParallelSnippetGenerator.cpp b/llvm/tools/llvm-exegesis/lib/ParallelSnippetGenerator.cpp
index 03506a2dd757c..79a585ec52957 100644
--- a/llvm/tools/llvm-exegesis/lib/ParallelSnippetGenerator.cpp
+++ b/llvm/tools/llvm-exegesis/lib/ParallelSnippetGenerator.cpp
@@ -80,7 +80,6 @@ namespace llvm {
namespace exegesis {
static bool hasVariablesWithTiedOperands(const Instruction &Instr) {
- SmallVector<const Variable *, 8> Result;
for (const auto &Var : Instr.Variables)
if (Var.hasTiedOperands())
return true;
diff --git a/llvm/unittests/Analysis/MemorySSATest.cpp b/llvm/unittests/Analysis/MemorySSATest.cpp
index ad4393ccd5315..fda3a713b5761 100644
--- a/llvm/unittests/Analysis/MemorySSATest.cpp
+++ b/llvm/unittests/Analysis/MemorySSATest.cpp
@@ -874,7 +874,6 @@ TEST_F(MemorySSATest, Irreducible) {
// }
// use(x)
- SmallVector<PHINode *, 8> Inserted;
IRBuilder<> B(C);
F = Function::Create(FunctionType::get(B.getVoidTy(), {B.getPtrTy()}, false),
GlobalValue::ExternalLinkage, "F", &M);
diff --git a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
index 8ae05c4ddc59a..4a05a293fa51f 100644
--- a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
@@ -1590,8 +1590,6 @@ TEST_F(CoreAPIsStandardTest, TestGetRequestedSymbolsAndReplace) {
// have pending queries, and test that MaterializationResponsibility's
// replace method can be used to return definitions to the JITDylib in a new
// MaterializationUnit.
- SymbolNameSet Names({Foo, Bar});
-
bool FooMaterialized = false;
bool BarMaterialized = false;
diff --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
index 01da439f069f1..1a1bb031afa7c 100644
--- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -2347,7 +2347,6 @@ TEST_F(OpenMPIRBuilderTest, UnrollLoopHeuristic) {
TEST_F(OpenMPIRBuilderTest, StaticWorkshareLoopTarget) {
using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
- std::string oldDLStr = M->getDataLayoutStr();
M->setDataLayout(
"e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:"
"256:256:32-p8:128:128-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:"
@@ -5554,7 +5553,6 @@ TEST_F(OpenMPIRBuilderTest, CreateSectionsSimple) {
OpenMPIRBuilder::LocationDescription Loc({Builder.saveIP(), DL});
llvm::SmallVector<BodyGenCallbackTy, 4> SectionCBVector;
- llvm::SmallVector<BasicBlock *, 4> CaseBBs;
auto FiniCB = [&](InsertPointTy IP) { return Error::success(); };
auto SectionCB = [&](InsertPointTy AllocaIP, InsertPointTy CodeGenIP) {
diff --git a/llvm/unittests/IR/DominatorTreeTest.cpp b/llvm/unittests/IR/DominatorTreeTest.cpp
index 555348c65a63d..828f2d60a31f2 100644
--- a/llvm/unittests/IR/DominatorTreeTest.cpp
+++ b/llvm/unittests/IR/DominatorTreeTest.cpp
@@ -681,7 +681,6 @@ TEST(DominatorTree, IDFDeterminismTest) {
IDF.setDefiningBlocks(DefBlocks);
SmallVector<BasicBlock *, 32> IDFBlocks;
- SmallPtrSet<BasicBlock *, 32> LiveInBlocks;
IDF.resetLiveInBlocks();
IDF.calculate(IDFBlocks);
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index 5e0092ddc18ba..ef83fcb1950c9 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -824,8 +824,6 @@ TEST_F(FileSystemTest, RealPathNoReadPerm) {
ASSERT_NO_ERROR(fs::remove_directories(Twine(TestDirectory) + "/noreadperm"));
}
TEST_F(FileSystemTest, RemoveDirectoriesNoExePerm) {
- SmallString<64> Expanded;
-
ASSERT_NO_ERROR(
fs::create_directories(Twine(TestDirectory) + "/noexeperm/foo"));
ASSERT_TRUE(fs::exists(Twine(TestDirectory) + "/noexeperm/foo"));
@@ -965,7 +963,6 @@ TEST_F(FileSystemTest, TempFileCollisions) {
FileRemover Cleanup(TestDirectory);
SmallString<128> Model = TestDirectory;
path::append(Model, "%.tmp");
- SmallString<128> Path;
std::vector<fs::TempFile> TempFiles;
auto TryCreateTempFile = [&]() {
More information about the llvm-commits
mailing list