[Mlir-commits] [mlir] [mlir][PDL] Relax PDL verification constraints (PR #172039)
Fabian Mora
llvmlistbot at llvm.org
Fri Dec 12 08:31:41 PST 2025
================
@@ -141,6 +141,14 @@ class ParentOneOf<list<string> ops>
: ParamNativeOpTrait<"HasParent", !interleave(ops, ", ")>,
StructuralOpTrait;
+// Op's parent operation is not the provided one.
+class HasParentNotOf<string op>
+ : ParamNativeOpTrait<"HasParentNotOf", op>, StructuralOpTrait;
+
+class ParentNotOneOf<list<string> ops>
+ : ParamNativeOpTrait<"HasParentNotOf", !interleave(ops, ", ")>,
+ StructuralOpTrait;
----------------
fabianmcg wrote:
To explain, let's take `apply_native_constraint` as an example.
Before, it had the the constraint: `HasParent<PatternOp>`. That constraint was not only for requiring a `PatternOp` as parent, but also to avoid the operation appearing in `RewriteOp`, as it's not valid in there.
The solution I came up with is, let's make sure still invalid in `RewriteOp`, but lets not impose restrictions on who the actual parent is.
https://github.com/llvm/llvm-project/pull/172039
More information about the Mlir-commits
mailing list