[Mlir-commits] [mlir] [MLIR][Transform][Tune] Introduce `transform.tune.alternatives` op (PR #160724)
Rolf Morel
llvmlistbot at llvm.org
Fri Sep 26 12:42:59 PDT 2025
================
----------------
rolfmorel wrote:
``(`selected_region` `=` custom<AlternativesOpSelectedRegion>($selected_region_attr, $selected_region_param)^)?`` makes it so that the entire sequence `selected_region = ??` is parsed optionally, where `??` is my notation for a wildcard. In this case, `??` only should accept one of two "tokens": either an integer literal or a SSA-value. `parseAlternativesOpSelectedRegion` is the function that implements this parsing, accepting either the literal or the SSA-value.
Because either an integer or SSA-value is valid, when `parseAlternativesOpSelectedRegion` first tries to parse the integer it needs to do so "optionally" so that it's not an outright failure when an integer is not encountered. This has little to do with the optionality of the overall clause, i.e. whether it was prefixed with "selected_region =". That is, it is equally valid to use `custom<AlternativesOpSelectedRegion>($selected_region_attr, $selected_region_param)` not wrapped in an optional clause, i.e. not wrapped in parentheses suffixed with a `?`.
Hope that helps.
https://github.com/llvm/llvm-project/pull/160724
More information about the Mlir-commits
mailing list