[Mlir-commits] [mlir] [mlir][ODS] Add `OptionalTypesMatchWith` and remove a custom assemblyFormat (PR #68876)

Benjamin Maxwell llvmlistbot at llvm.org
Tue Oct 17 01:34:32 PDT 2023


MacDue wrote:

> Nice!
> 
> > This is just a slight specialization of `TypesMatchWith` that returns success if an optional parameter is missing.
> > There may be other places this could help e.g.: https://github.com/llvm/llvm-project/blob/eb21049b4b904b072679ece60e73c6b0dc0d1ebf/mlir/include/mlir/Dialect/X86Vector/X86Vector.td#L58C5-L58C5 ...but I'm leaving those to avoid some churn.
> > (This constraint will be handy for us in some later patches)
> 
> * Line numbers in your link are incorrect ("L58C5-L58C5")
> * "(This constraint will be handy for us in some later patches)" - for completeness, are you able to make this more specific or perhaps even refer to some existing PR?

This is a formalization of the comparator trick I came up with for Cullen in #69195:
```
  TypesMatchWith<
    "padding type matches element type of result (if present)",
    "result", "padding",
    "::llvm::cast<VectorType>($_self).getElementType()",
    "!getPadding() || std::equal_to<>()"
  >
```
Giving it a proper name seemed like it'd help make it more discoverable. 

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


More information about the Mlir-commits mailing list