[Mlir-commits] [mlir] [MLIR][Rewrite] Support unqualified pattern names in disable/enable-patterns (PR #188988)

Mehdi Amini llvmlistbot at llvm.org
Wed Apr 22 06:40:56 PDT 2026


================
@@ -83,20 +79,41 @@ FrozenRewritePatternSet::FrozenRewritePatternSet(
         impl->nativeOpSpecificPatternList.push_back(std::move(pattern));
       };
 
+  // Returns true if `label` (a pattern's debug name or label) matches
+  // `userLabel` (a user-supplied filter string). Supports both exact matching
+  // and unqualified-name matching: if `userLabel` contains no "::", it is also
+  // compared against the unqualified part of `label` (after the last "::").
+  // This allows users to write, e.g., `disable-patterns=FooBar` instead of
+  // `disable-patterns=(anonymous namespace)::FooBar`.
+  auto matchesLabel = [](StringRef label, StringRef userLabel) {
+    if (label == userLabel)
+      return true;
+    if (!userLabel.contains("::")) {
----------------
joker-eph wrote:

Done!

https://github.com/llvm/llvm-project/pull/188988


More information about the Mlir-commits mailing list