Issue |
151640
|
Summary |
[mlir] `Operation::clone` doesn't clone properties of unregister ops
|
Labels |
mlir
|
Assignees |
|
Reporter |
uenoku
|
@fabianschuiki and I have seen `Operation::clone` drops properties of unregistered ops in downstream projects. This is a reproducer using `test-clone` pass:
```mlir
$ cat test.mlir
"builtin.module"() ({
"func.func"() <{function_type = () -> (), sym_name = "func"}> ({
"unregistered.foo" ()<{bar = 1}> : () -> ()
}) : () -> ()
}) : () -> ()
$ mlir-opt test.mlir --pass-pipeline='builtin.module(func.func(test-clone))' -allow-unregistered-dialect -mlir-print-ir-before-all -mlir-print-ir-after-all
// -----// IR Dump Before (anonymous namespace)::ClonePass (test-clone) //----- //
func.func @func() {
"unregistered.foo"() <{bar = 1 : i64}> : () -> ()
}
notifyOperationInserted: unregistered.foo
// -----// IR Dump After (anonymous namespace)::ClonePass (test-clone) //----- //
func.func @func() {
"unregistered.foo"() : () -> ()
}
module {
func.func @func() {
"unregistered.foo"() : () -> ()
}
}
```
I debugged a bit and I think `getPropertiesStorage` in the following code always returns null for unregister ops. I think it's necessary to initialize OperationState's `propertiesAttr` for unregistered ops instead.
https://github.com/llvm/llvm-project/blob/9c90f848fda9992ab6294d33665c1e2eb0613c0a/mlir/lib/IR/Operation.cpp#L735-L736
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs