[Mlir-commits] [mlir] [MLIR] Fix duplicated attribute nodes in MLIR bytecode deserialization (PR #151267)

Tobias Gysi llvmlistbot at llvm.org
Wed Aug 6 13:07:35 PDT 2025


================
@@ -0,0 +1,32 @@
+// RUN: mlir-opt -emit-bytecode %s | mlir-translate --mlir-to-llvmir | FileCheck %s
+
+#di_basic_type = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "int", sizeInBits = 32, encoding = DW_ATE_signed>
+#di_file = #llvm.di_file<"foo.c" in "/mlir/">
+#di_file1 = #llvm.di_file<"foo.c" in "/mlir/">
+#di_subprogram = #llvm.di_subprogram<recId = distinct[0]<>, isRecSelf = true>
+#di_compile_unit = #llvm.di_compile_unit<id = distinct[1]<>, sourceLanguage = DW_LANG_C11, file = #di_file, producer = "MLIR", isOptimized = true, emissionKind = Full, nameTableKind = None>
+#di_local_variable = #llvm.di_local_variable<scope = #di_subprogram, name = "a", file = #di_file1, line = 2, type = #di_basic_type>
+#di_subroutine_type = #llvm.di_subroutine_type<types = #di_basic_type>
+#di_subprogram1 = #llvm.di_subprogram<recId = distinct[0]<>, id = distinct[2]<>, compileUnit = #di_compile_unit, scope = #di_file1, name = "main", file = #di_file1, line = 1, scopeLine = 1, subprogramFlags = "Definition|Optimized", type = #di_subroutine_type, retainedNodes = #di_local_variable>
+#di_local_variable1 = #llvm.di_local_variable<scope = #di_subprogram1, name = "a", file = #di_file1, line = 2, type = #di_basic_type>
+
+module attributes {dlti.dl_spec = #dlti.dl_spec<i64 = dense<64> : vector<2xi64>, !llvm.ptr = dense<64> : vector<4xi64>>, llvm.ident = "MLIR", llvm.target_triple = "x86_64-unknown-linux-gnu"} {
----------------
gysit wrote:

Could we attach the the same distinct attribute to multiple test ops and then check they roundtrip correctly. Or does it only work if they show up in an alias?

Something like:
```
test_op attributes { distinct[0]<>, distinct[1]<>}
test_op attributes { distinct[1]<>, distinct[0]<>}
```


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


More information about the Mlir-commits mailing list