[Mlir-commits] [mlir] [MLIR][PDL] Enable strict property assembly format (PR #217296)
Mehdi Amini
llvmlistbot at llvm.org
Wed Aug 19 03:54:37 PDT 2026
https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/217296
Enable the strict properties assembly format mode for the PDL dialect. Spell the default-valued isNegated attribute directly in the assembly format so it is no longer parsed from attr-dict in strict mode.
Assisted-by: Codex
>From 86d38383d40849a342d1bb720a8429ccb77e9f12 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Wed, 6 May 2026 13:31:21 -0700
Subject: [PATCH] [MLIR][PDL] Enable strict property assembly format
Enable the strict properties assembly format mode for the PDL dialect.
Spell the default-valued isNegated attribute directly in the assembly
format so it is no longer parsed from attr-dict in strict mode.
Assisted-by: Codex
---
mlir/include/mlir/Dialect/PDL/IR/PDLDialect.td | 1 +
mlir/include/mlir/Dialect/PDL/IR/PDLOps.td | 3 ++-
.../Conversion/PDLToPDLInterp/pdl-to-pdl-interp-matcher.mlir | 2 +-
mlir/test/mlir-pdll/CodeGen/MLIR/expr.pdll | 2 +-
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/mlir/include/mlir/Dialect/PDL/IR/PDLDialect.td b/mlir/include/mlir/Dialect/PDL/IR/PDLDialect.td
index d405bec26634c..b98940560ef52 100644
--- a/mlir/include/mlir/Dialect/PDL/IR/PDLDialect.td
+++ b/mlir/include/mlir/Dialect/PDL/IR/PDLDialect.td
@@ -63,6 +63,7 @@ def PDL_Dialect : Dialect {
}];
let name = "pdl";
+ let useStrictPropertiesInAssemblyFormat = 1;
let cppNamespace = "::mlir::pdl";
let useDefaultTypePrinterParser = 1;
diff --git a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
index 6ee638c19d1ad..71f060cc80019 100644
--- a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
+++ b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
@@ -52,7 +52,8 @@ def PDL_ApplyNativeConstraintOp
DefaultValuedAttr<BoolAttr, "false">:$isNegated);
let results = (outs Variadic<PDL_AnyType>:$results);
let assemblyFormat = [{
- $name `(` $args `:` type($args) `)` (`:` type($results)^ )? attr-dict
+ $name `(` $args `:` type($args) `)`
+ (`is_negated` `=` $isNegated^)? (`:` type($results)^ )? attr-dict
}];
let hasVerifier = 1;
}
diff --git a/mlir/test/Conversion/PDLToPDLInterp/pdl-to-pdl-interp-matcher.mlir b/mlir/test/Conversion/PDLToPDLInterp/pdl-to-pdl-interp-matcher.mlir
index ed6407a632395..bb4a7249a2fd3 100644
--- a/mlir/test/Conversion/PDLToPDLInterp/pdl-to-pdl-interp-matcher.mlir
+++ b/mlir/test/Conversion/PDLToPDLInterp/pdl-to-pdl-interp-matcher.mlir
@@ -137,7 +137,7 @@ module @negated_constraint {
// CHECK: pdl_interp.record_match @rewriters::@pdl_generated_rewriter(%[[ROOT]] : !pdl.operation)
pdl.pattern : benefit(1) {
%root = operation
- pdl.apply_native_constraint "constraint"(%root : !pdl.operation) {isNegated = true}
+ pdl.apply_native_constraint "constraint"(%root : !pdl.operation) is_negated = true
rewrite %root with "rewriter"
}
}
diff --git a/mlir/test/mlir-pdll/CodeGen/MLIR/expr.pdll b/mlir/test/mlir-pdll/CodeGen/MLIR/expr.pdll
index 948571cd7e5c8..00ceaca31771c 100644
--- a/mlir/test/mlir-pdll/CodeGen/MLIR/expr.pdll
+++ b/mlir/test/mlir-pdll/CodeGen/MLIR/expr.pdll
@@ -38,7 +38,7 @@ Pattern TestExternalCall => replace root: Op with TestRewrite(root);
// CHECK: pdl.pattern @TestExternalNegatedCall
// CHECK: %[[ROOT:.*]] = operation
-// CHECK: apply_native_constraint "TestConstraint"(%[[ROOT]] : !pdl.operation) {isNegated = true}
+// CHECK: apply_native_constraint "TestConstraint"(%[[ROOT]] : !pdl.operation) is_negated = true
// CHECK: rewrite %[[ROOT]]
// CHECK: erase %[[ROOT]]
Constraint TestConstraint(op: Op);
More information about the Mlir-commits
mailing list