From bd0fcb299b0a24f39e57d74736126667c2d83386 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Mon, 10 Mar 2025 15:28:54 +0000 Subject: [PATCH] [MLIR][OneShotBufferize] Fix opFilter init OneShotBufferizePass's opFilter definition in runOnOperation() fails to allow operations for all dialect when the dialectFilter has an empty array value (as opposed to no value). This happens when constructing OneShotBufferizePass from a OneShotBufferizePassOptions parameter with an empty dialectFilter. This commit only does filtering if filterDialect option has a value and it is not an empty array. --- mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp index 97d4aab9f3dd5..c0e3fca428376 100644 --- a/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp +++ b/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp @@ -142,7 +142,7 @@ struct OneShotBufferizePass // Configure op filter. OpFilter::Entry::FilterFn filterFn = [&](Operation *op) { // Filter may be specified via options. - if (this->dialectFilter.hasValue()) + if (this->dialectFilter.hasValue() && !(*this->dialectFilter).empty()) return llvm::is_contained(this->dialectFilter, op->getDialect()->getNamespace()); // No filter specified: All other ops are allowed.