[Mlir-commits] [mlir] [MLIR][LLVM] More on CG Profile: support null function entries (PR #137269)
Bruno Cardoso Lopes
llvmlistbot at llvm.org
Fri Apr 25 15:09:49 PDT 2025
================
@@ -1370,10 +1370,17 @@ def ModuleFlagCGProfileEntryAttr
]>]
```
}];
- let parameters = (ins "FlatSymbolRefAttr":$from,
- "FlatSymbolRefAttr":$to,
- "uint64_t":$count);
- let assemblyFormat = "`<` struct(params) `>`";
+ let parameters = (
+ ins OptionalParameter<"std::optional<FlatSymbolRefAttr>">:$from,
+ OptionalParameter<"std::optional<FlatSymbolRefAttr>">:$to,
----------------
bcardosolopes wrote:
The problem is that we either get:
- `to = @<<INVALID EMPTY SYMBOL>>` for passing an empty string to `FlatSymbolRefAttr`, or
- `to =, count = 2` for passing `nullptr`. I could live with this, but `to = null, count = 2` feels nicer to me.
When I use `OptionalParameter<"FlatSymbolRefAttr">`, the printer works successfully but parser fails on `to = null` with `failed to parse ModuleFlagCGProfileEntryAttr parameter 'to' which is to be a FlatSymbolRefAttr`. Seems like a current limitation of emitted tablegen code? Perhaps this explains why some other places also do the double optional trick. If you feel stronger about other options let me know and will fix them in a follow up PR.
https://github.com/llvm/llvm-project/pull/137269
More information about the Mlir-commits
mailing list