[Mlir-commits] [mlir] [mlir][Pass] Fix crash when applying a pass to an optional interface (PR #168499)
Matthias Springer
llvmlistbot at llvm.org
Wed Nov 19 20:09:41 PST 2025
================
@@ -475,3 +475,35 @@ module attributes {transform.with_named_sequence} {
"transform.yield"() : () -> ()
}) : () -> ()
}) {transform.with_named_sequence} : () -> ()
+
+// -----
+
+module attributes {transform.with_named_sequence} {
+ // Unnamed modules do not implement SymbolOpInterface, so test-print-liveness
+ // cannot be applied.
+ // expected-error @+2 {{trying to schedule pass '(anonymous namespace)::TestLivenessPass' on an unsupported operation}}
+ // expected-note @+1 {{target op}}
+ builtin.module attributes{test.target} {}
+
+ transform.named_sequence @__transform_main(%arg1: !transform.any_op) {
+ %1 = transform.structured.match ops{["builtin.module"]} attributes {test.target} in %arg1 : (!transform.any_op) -> !transform.any_op
+
+ // expected-error @below {{pass pipeline failed}}
+ transform.apply_registered_pass "test-print-liveness" to %1 : (!transform.any_op) -> !transform.any_op
+ transform.yield
+ }
+}
+
+// -----
+
+module attributes {transform.with_named_sequence} {
+ // Named modules implement SymbolOpInterface, so test-print-liveness can be
+ // applied.
+ builtin.module @named_module attributes{test.target} {}
+
+ transform.named_sequence @__transform_main(%arg1: !transform.any_op) {
+ %1 = transform.structured.match ops{["builtin.module"]} attributes {test.target} in %arg1 : (!transform.any_op) -> !transform.any_op
+ transform.apply_registered_pass "test-print-liveness" to %1 : (!transform.any_op) -> !transform.any_op
+ transform.yield
+ }
+}
----------------
matthias-springer wrote:
Moved to invalid-unsupported-operation.mlir.
https://github.com/llvm/llvm-project/pull/168499
More information about the Mlir-commits
mailing list