[Mlir-commits] [mlir] 2fb12bc - [mlir][tblgen] Prune unused filterForDialect template [-Wunused-template] (#221422)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Sep 5 11:31:12 PDT 2026


Author: Henrich Lauko
Date: 2026-09-05T11:31:07-07:00
New Revision: 2fb12bca76c52d8e0bbb838017820ee58a395293

URL: https://github.com/llvm/llvm-project/commit/2fb12bca76c52d8e0bbb838017820ee58a395293
DIFF: https://github.com/llvm/llvm-project/commit/2fb12bca76c52d8e0bbb838017820ee58a395293.diff

LOG: [mlir][tblgen] Prune unused filterForDialect template [-Wunused-template] (#221422)

`filterForDialect` lost its last caller in 4957518ef57f (May 2022) and
has been dead since. It is a static file-scope function template, so
`-Wunused-template` flags it and `-Werror` builds fail. Removing it also
orphans the `DialectFilterIterator` alias and the `llvm::Record`
using-declaration, which nothing else references, so this drops all
three.

Co-authored-by: Henrich Lauko <hlauko at nvidia.com>

Added: 
    

Modified: 
    mlir/tools/mlir-tblgen/DialectGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-tblgen/DialectGen.cpp b/mlir/tools/mlir-tblgen/DialectGen.cpp
index d2f9faa7a9db5..d6977b1f22579 100644
--- a/mlir/tools/mlir-tblgen/DialectGen.cpp
+++ b/mlir/tools/mlir-tblgen/DialectGen.cpp
@@ -31,7 +31,6 @@
 
 using namespace mlir;
 using namespace mlir::tblgen;
-using llvm::Record;
 using llvm::RecordKeeper;
 
 static llvm::cl::OptionCategory dialectGenCat("Options for -gen-dialect-*");
@@ -39,13 +38,6 @@ static llvm::cl::opt<std::string>
     selectedDialect("dialect", llvm::cl::desc("The dialect to gen for"),
                     llvm::cl::cat(dialectGenCat), llvm::cl::CommaSeparated);
 
-/// Utility iterator used for filtering records for a specific dialect.
-namespace {
-using DialectFilterIterator =
-    llvm::filter_iterator<ArrayRef<Record *>::iterator,
-                          std::function<bool(const Record *)>>;
-} // namespace
-
 static void populateDiscardableAttributes(
     Dialect &dialect, const llvm::DagInit *discardableAttrDag,
     SmallVector<std::pair<std::string, std::string>> &discardableAttributes) {
@@ -61,18 +53,6 @@ static void populateDiscardableAttributes(
   }
 }
 
-/// Given a set of records for a T, filter the ones that correspond to
-/// the given dialect.
-template <typename T>
-static iterator_range<DialectFilterIterator>
-filterForDialect(ArrayRef<Record *> records, Dialect &dialect) {
-  auto filterFn = [&](const Record *record) {
-    return T(record).getDialect() == dialect;
-  };
-  return {DialectFilterIterator(records.begin(), records.end(), filterFn),
-          DialectFilterIterator(records.end(), records.end(), filterFn)};
-}
-
 std::optional<Dialect>
 tblgen::findDialectToGenerate(ArrayRef<Dialect> dialects) {
   if (dialects.empty()) {


        


More information about the Mlir-commits mailing list