[llvm] [llvm] Remove unused local variables (NFC) (PR #140422)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat May 17 17:18:22 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/140422

None

>From f622877e83c981306e59ab3f4d07982e8a6508f6 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 3 May 2025 23:50:31 -0700
Subject: [PATCH] [llvm] Remove unused local variables (NFC)

---
 llvm/lib/Object/Object.cpp                              | 1 -
 llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp | 1 -
 llvm/lib/Target/X86/X86ISelLowering.cpp                 | 1 -
 llvm/tools/llvm-mca/llvm-mca.cpp                        | 2 --
 llvm/tools/llvm-rc/ResourceFileWriter.cpp               | 1 -
 5 files changed, 6 deletions(-)

diff --git a/llvm/lib/Object/Object.cpp b/llvm/lib/Object/Object.cpp
index d5e67160dfa36..c62944ad3eeba 100644
--- a/llvm/lib/Object/Object.cpp
+++ b/llvm/lib/Object/Object.cpp
@@ -182,7 +182,6 @@ LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf) {
   std::unique_ptr<MemoryBuffer> Buf(unwrap(MemBuf));
   Expected<std::unique_ptr<ObjectFile>> ObjOrErr(
       ObjectFile::createObjectFile(Buf->getMemBufferRef()));
-  std::unique_ptr<ObjectFile> Obj;
   if (!ObjOrErr) {
     // TODO: Actually report errors helpfully.
     consumeError(ObjOrErr.takeError());
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index aac68b32da13a..aac3473311192 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -2871,7 +2871,6 @@ SDValue WebAssemblyTargetLowering::LowerShift(SDValue Op,
 
 SDValue WebAssemblyTargetLowering::LowerFP_TO_INT_SAT(SDValue Op,
                                                       SelectionDAG &DAG) const {
-  SDLoc DL(Op);
   EVT ResT = Op.getValueType();
   EVT SatVT = cast<VTSDNode>(Op.getOperand(1))->getVT();
 
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 6b4b4beb97ca5..96219c51d4bb6 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -53260,7 +53260,6 @@ static SDValue combineMaskedStore(SDNode *N, SelectionDAG &DAG,
     return SDValue();
 
   EVT VT = Mst->getValue().getValueType();
-  SDLoc dl(Mst);
   const TargetLowering &TLI = DAG.getTargetLoweringInfo();
 
   if (Mst->isTruncatingStore())
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index e2eb21058c2d6..4b0611186d21f 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -454,8 +454,6 @@ int main(int argc, char **argv) {
   // Tell SrcMgr about this buffer, which is what the parser will pick up.
   SrcMgr.AddNewSourceBuffer(std::move(*BufferPtr), SMLoc());
 
-  std::unique_ptr<buffer_ostream> BOS;
-
   std::unique_ptr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo());
   assert(MCII && "Unable to create instruction info!");
 
diff --git a/llvm/tools/llvm-rc/ResourceFileWriter.cpp b/llvm/tools/llvm-rc/ResourceFileWriter.cpp
index 85b59532bb83b..dc21f63a682aa 100644
--- a/llvm/tools/llvm-rc/ResourceFileWriter.cpp
+++ b/llvm/tools/llvm-rc/ResourceFileWriter.cpp
@@ -1573,7 +1573,6 @@ Expected<std::unique_ptr<MemoryBuffer>>
 ResourceFileWriter::loadFile(StringRef File) const {
   SmallString<128> Path;
   SmallString<128> Cwd;
-  std::unique_ptr<MemoryBuffer> Result;
 
   // 0. The file path is absolute or has a root directory, so we shouldn't
   // try to append it on top of other base directories. (An absolute path



More information about the llvm-commits mailing list