[Mlir-commits] [mlir] [mlir][tblgen] Prune unused filterForDialect template [-Wunused-template] (PR #221422)
Henrich Lauko
llvmlistbot at llvm.org
Sat Sep 5 01:09:53 PDT 2026
https://github.com/xlauko created https://github.com/llvm/llvm-project/pull/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. Generated output is unchanged.
>From 7d7414aa1ff76f6b9d6e00e166aeb57bd367ccd0 Mon Sep 17 00:00:00 2001
From: Henrich Lauko <hlauko at nvidia.com>
Date: Sat, 5 Sep 2026 08:09:24 +0000
Subject: [PATCH] [mlir][tblgen] Prune unused filterForDialect template
[-Wunused-template]
`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. Generated output is unchanged.
---
mlir/tools/mlir-tblgen/DialectGen.cpp | 20 --------------------
1 file changed, 20 deletions(-)
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