Skip to content

Conversation

kazutakahirata
Copy link
Contributor

Identified with bugprone-unused-local-non-trivial-variable.

Identified with bugprone-unused-local-non-trivial-variable.
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels Oct 12, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 12, 2025

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-core

Author: Kazu Hirata (kazutakahirata)

Changes

Identified with bugprone-unused-local-non-trivial-variable.


Full diff: https://github.com/llvm/llvm-project/pull/163105.diff

3 Files Affected:

  • (modified) mlir/lib/Target/IRDLToCpp/IRDLToCpp.cpp (-6)
  • (modified) mlir/tools/mlir-tblgen/CppGenUtilities.cpp (-2)
  • (modified) mlir/unittests/IR/RemarkTest.cpp (-4)
diff --git a/mlir/lib/Target/IRDLToCpp/IRDLToCpp.cpp b/mlir/lib/Target/IRDLToCpp/IRDLToCpp.cpp
index e3f075fcc1294..8ecb08456da1a 100644
--- a/mlir/lib/Target/IRDLToCpp/IRDLToCpp.cpp
+++ b/mlir/lib/Target/IRDLToCpp/IRDLToCpp.cpp
@@ -464,12 +464,6 @@ static std::string generateOpDefinition(irdl::detail::dictionary &dict,
   auto opStrings = getStrings(op);
   fillDict(dict, opStrings);
 
-  const auto operandCount = opStrings.opOperandNames.size();
-  const auto operandNames =
-      operandCount ? joinNameList(opStrings.opOperandNames) : "{\"\"}";
-
-  const auto resultNames = joinNameList(opStrings.opResultNames);
-
   auto resultTypes = llvm::join(
       llvm::map_range(opStrings.opResultNames,
                       [](StringRef attr) -> std::string {
diff --git a/mlir/tools/mlir-tblgen/CppGenUtilities.cpp b/mlir/tools/mlir-tblgen/CppGenUtilities.cpp
index fddd7790a4375..7cead353396dd 100644
--- a/mlir/tools/mlir-tblgen/CppGenUtilities.cpp
+++ b/mlir/tools/mlir-tblgen/CppGenUtilities.cpp
@@ -18,8 +18,6 @@ void mlir::tblgen::emitSummaryAndDescComments(llvm::raw_ostream &os,
                                               llvm::StringRef summary,
                                               llvm::StringRef description,
                                               bool terminateComment) {
-
-  std::string comments = "";
   StringRef trimmedSummary = summary.trim();
   StringRef trimmedDesc = description.trim();
   raw_indented_ostream ros(os);
diff --git a/mlir/unittests/IR/RemarkTest.cpp b/mlir/unittests/IR/RemarkTest.cpp
index 5bfca255c22ca..bcbda90cf69cb 100644
--- a/mlir/unittests/IR/RemarkTest.cpp
+++ b/mlir/unittests/IR/RemarkTest.cpp
@@ -149,7 +149,6 @@ TEST(Remark, TestNoOutputOptimizationRemark) {
 
   std::string categoryFailName("myImportantCategory");
   std::string myPassname1("myPass1");
-  std::string funcName("myFunc");
   SmallString<64> tmpPathStorage;
   sys::fs::createUniquePath("remarks-%%%%%%.yaml", tmpPathStorage,
                             /*MakeAbsolute=*/true);
@@ -271,9 +270,6 @@ TEST(Remark, TestCustomOptimizationRemarkDiagnostic) {
   std::string categoryInline("Inliner");
   std::string myPassname1("myPass1");
   std::string myPassname2("myPass2");
-  std::string funcName("myFunc");
-
-  std::string seenMsg = "";
 
   {
     MLIRContext context;

@kazutakahirata kazutakahirata merged commit a2a146b into llvm:main Oct 13, 2025
13 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20251012_unused_var_mlir branch October 13, 2025 03:51
DharuniRAcharya pushed a commit to DharuniRAcharya/llvm-project that referenced this pull request Oct 13, 2025
Identified with bugprone-unused-local-non-trivial-variable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mlir:core MLIR Core Infrastructure mlir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants