<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/155210>155210</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[MLIR] Broken bytecode roundtrip for properties
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir:core,
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Dinistro
</td>
</tr>
</table>
<pre>
There seems to be some unexpected issue in the bytecode rountrip. When running `mlir-opt -verify-roundtrip` with the following input, the property parsing explodes.
```
llvm.func @foo()
llvm.func @repro(%val: f32) {
llvm.call @foo() : () -> ()
%t = arith.addf %val, %val : f32
llvm.return
}
```
Crash log:
```
loc("-":8:10): error: invalid properties {fastmath = #llvm.fastmath<none>} for op arith.addf: Invalid attribute `fastmath` in property conversion: #llvm.fastmath<none>
repro.mlir:0:0: error: 'builtin.module' op failed to parse textual content back, cannot verify round-trip.
repro.mlir:0:0: note: see current operation:
"builtin.module"() ({
"llvm.func"() <{CConv = #llvm.cconv<ccc>, function_type = !llvm.func<void ()>, linkage = #llvm.linkage<external>, sym_name = "foo", unnamed_addr = 0 : i64, visibility_ = 0 : i64}> ({
}) : () -> ()
"llvm.func"() <{CConv = #llvm.cconv<ccc>, function_type = !llvm.func<void (f32)>, linkage = #llvm.linkage<external>, sym_name = "repro", unnamed_addr = 0 : i64, visibility_ = 0 : i64}> ({
^bb0(%arg0: f32):
"llvm.call"() <{CConv = #llvm.cconv<ccc>, TailCallKind = #llvm.tailcallkind<none>, callee = @foo, fastmathFlags = #llvm.fastmath<none>, op_bundle_sizes = array<i32>, operandSegmentSizes = array<i32: 0, 0>}> : () -> ()
%0 = "arith.addf"(%arg0, %arg0) <{fastmath = #arith.fastmath<none>}> : (f32, f32) -> f32
"llvm.return"() : () -> ()
}) : () -> ()
}) : () -> ()
loc("-":0:0): error: expected mlir::arith::FastMathFlagsAttr, but got: #llvm.fastmath<none>
repro.mlir:0:0: error: 'builtin.module' op failed to parse bytecode content back, cannot verify round-trip.
repro.mlir:0:0: note: see current operation:
"builtin.module"() ({
"llvm.func"() <{CConv = #llvm.cconv<ccc>, function_type = !llvm.func<void ()>, linkage = #llvm.linkage<external>, sym_name = "foo", unnamed_addr = 0 : i64, visibility_ = 0 : i64}> ({
}) : () -> ()
"llvm.func"() <{CConv = #llvm.cconv<ccc>, function_type = !llvm.func<void (f32)>, linkage = #llvm.linkage<external>, sym_name = "repro", unnamed_addr = 0 : i64, visibility_ = 0 : i64}> ({
^bb0(%arg0: f32):
"llvm.call"() <{CConv = #llvm.cconv<ccc>, TailCallKind = #llvm.tailcallkind<none>, callee = @foo, fastmathFlags = #llvm.fastmath<none>, op_bundle_sizes = array<i32>, operandSegmentSizes = array<i32: 0, 0>}> : () -> ()
%0 = "arith.addf"(%arg0, %arg0) <{fastmath = #arith.fastmath<none>}> : (f32, f32) -> f32
"llvm.return"() : () -> ()
}) : () -> ()
}) : () -> ()
```
So far, I'm not entirely sure what might have introduce this breakage. For now, my suspicion is https://github.com/llvm/llvm-project/pull/151267 (FYI: @hankluo6 @joker-eph). I'll try to revert this commit locally to see if that resolves my issue. I'll report back once I gathered insights.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsV01v4zgP_jXKhUigyLHdHHJwnQlQvO9cdgZY7KmQbTrWVJYMiU6b_fULyU76gQ6KXQzmVCCFBZGi-PHwUSm9V0eDuGPpLUv3CzlSZ91ur4zy5Oyiss15971Dh-ARew9koULwtkcYDT4NWBM2oLwfEZQB6hCqM2FtGwRnR0NODSv4s0MDbjRGmSOwjPdauaUdCJYndKo9L4NqE3RZxuFRURcttVZr-xjOKDOMxEQZtwdnB3R0hkE6H6T4NGjboF8xXoRfxucfL7Q-9at2NDWwDW-tZeKGie2k90rmcHCTND1JzZIC2kQwsQWW3zJeQFSupdavDEFQnJdLlnyBq30AJlICluxBOkXdSjZNC7N1Uc4ruFwUHZoucUijM2En37-JhvGidNJ3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