[Mlir-commits] [mlir] [mlir][ptr] Add load and store ops. (PR #156093)
Fabian Mora
llvmlistbot at llvm.org
Sun Aug 31 04:58:24 PDT 2025
================
@@ -773,9 +773,10 @@ class OptionalProp<Property p, bit canDelegateParsing = 1>
}];
let writeToMlirBytecode = [{
$_writer.writeOwnedBool($_storage.has_value());
- if (!$_storage.has_value())
- return;
- }] # !subst("$_storage", "(*($_storage))", p.writeToMlirBytecode);
+ if ($_storage.has_value()) {
+ }] # !subst("$_storage", "(*($_storage))", p.writeToMlirBytecode) # [{
----------------
fabianmcg wrote:
Previously, you had something like:
```C++
{
auto &propStorage = prop.alignment;
writer.writeOwnedBool(propStorage.has_value());
if (propStorage.has_value())
return;
writer.writeVarInt((*(propStorage)));
}
// ... other props
```
That code skips writing further props if the optional is empty, which is an error. Now, instead of returning I test if the value is present and the write it, instead of doing early exit.
```C++
{
auto &propStorage = prop.alignment;
writer.writeOwnedBool(propStorage.has_value());
if (propStorage.has_value()) {
writer.writeVarInt((*(propStorage)));
};
}
// ... other
```
The way I realized this was using `--verify-roundtrip`, which was failing because of the bytecode.
https://github.com/llvm/llvm-project/pull/156093
More information about the Mlir-commits
mailing list