[Mlir-commits] [mlir] [mlir] transform dialect; add pre/post-condition type (PR #191813)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Thu Apr 16 08:29:33 PDT 2026


================
@@ -0,0 +1,82 @@
+// RUN: mlir-opt %s --split-input-file --verify-diagnostics --transform-interpreter
+
+// expected-error @below {{normal form test_single_block_normal_form requires payload operations to have a single region}}
+func.func private @empty()
+
+module attributes {transform.with_named_sequence} {
+  transform.named_sequence @__transform_main(%arg0: !transform.any_op) {
+    transform.structured.match attributes {sym_name = "empty"} in %arg0 : (!transform.any_op) -> !transform.normalized_op<#transform.test_single_block_normal_form<nested false>>
+    transform.yield
+  }
+}
+
+// -----
+
+// expected-remark @below {{found}}
+func.func private @single() {
+  return
+}
+
+module attributes {transform.with_named_sequence} {
+  transform.named_sequence @__transform_main(%arg0: !transform.any_op) {
+    %0 = transform.structured.match attributes {sym_name = "single"} in %arg0 : (!transform.any_op) -> !transform.normalized_op<#transform.test_single_block_normal_form<nested false>>
+    transform.debug.emit_remark_at %0, "found" : !transform.normalized_op<#transform.test_single_block_normal_form<nested false>>
----------------
ftynse wrote:

As long as the normal form is preserved, yes. We could introduce a shorthand for type-identity ops to avoid spelling it twice, but it has to be present somewhere to allow for local parsing of the IR. (Though we can go back to `any_op` and then re-inject the form with `transform.cast`, this would result in rerunning the checker.)

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


More information about the Mlir-commits mailing list