[PATCH] D116055: [mlir] Canonicalizer constructor should accept disabled/enabled patterns
Jeff Niu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 20 13:39:52 PST 2021
Mogball updated this revision to Diff 395519.
Mogball added a comment.
Fix diff
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116055/new/
https://reviews.llvm.org/D116055
Files:
mlir/include/mlir/Transforms/Passes.h
mlir/lib/Transforms/Canonicalizer.cpp
Index: mlir/lib/Transforms/Canonicalizer.cpp
===================================================================
--- mlir/lib/Transforms/Canonicalizer.cpp
+++ mlir/lib/Transforms/Canonicalizer.cpp
@@ -21,7 +21,13 @@
namespace {
/// Canonicalize operations in nested regions.
struct Canonicalizer : public CanonicalizerBase<Canonicalizer> {
- Canonicalizer(const GreedyRewriteConfig &config) : config(config) {}
+ Canonicalizer(const GreedyRewriteConfig &config,
+ ArrayRef<std::string> disabledPatterns,
+ ArrayRef<std::string> enabledPatterns)
+ : config(config) {
+ this->disabledPatterns = disabledPatterns;
+ this->enabledPatterns = enabledPatterns;
+ }
Canonicalizer() {
// Default constructed Canonicalizer takes its settings from command line
@@ -61,6 +67,9 @@
/// Creates an instance of the Canonicalizer pass with the specified config.
std::unique_ptr<Pass>
-mlir::createCanonicalizerPass(const GreedyRewriteConfig &config) {
- return std::make_unique<Canonicalizer>(config);
+createCanonicalizerPass(const GreedyRewriteConfig &config,
+ ArrayRef<std::string> disabledPatterns = llvm::None,
+ ArrayRef<std::string> enabledPatterns = llvm::None) {
+ return std::make_unique<Canonicalizer>(config, disabledPatterns,
+ enabledPatterns);
}
Index: mlir/include/mlir/Transforms/Passes.h
===================================================================
--- mlir/include/mlir/Transforms/Passes.h
+++ mlir/include/mlir/Transforms/Passes.h
@@ -62,8 +62,13 @@
std::unique_ptr<Pass> createCanonicalizerPass();
/// Creates an instance of the Canonicalizer pass with the specified config.
+/// `disabledPatterns` is a set of labels used to filter out input patterns with
+/// a label in this set. `enabledPatterns` is a set of labels used to filter out
+/// input patterns that do not have one of the labels in this set.
std::unique_ptr<Pass>
-createCanonicalizerPass(const GreedyRewriteConfig &config);
+createCanonicalizerPass(const GreedyRewriteConfig &config,
+ ArrayRef<std::string> disabledPatterns = llvm::None,
+ ArrayRef<std::string> enabledPatterns = llvm::None);
/// Creates a pass to perform common sub expression elimination.
std::unique_ptr<Pass> createCSEPass();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116055.395519.patch
Type: text/x-patch
Size: 2381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211220/ab1949f6/attachment.bin>
More information about the llvm-commits
mailing list