[llvm] [mlir] [NFC] Add assert to validate `Objects` list for `HwModeSelect` (PR #123794)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 09:47:38 PST 2025


jurahul wrote:

> The Objects list has a different type in each subclass. Is it possible to pass the type to HwModeSelect somehow?

Unfortunately, I could not find a way to pass the type, but I have made a change in how failing asserts are handled in the TableGen flow, which I think improves the user experience a bit. I'll start the review once the CI is green.

Currently, in the `HwModeSelect.td` which exercises this error case, tablegen prints an error message but does not terminate (in the C++ error check code) and later fails an assert in `zip_equal` (in HwModeSelect::HwModeSelect). With the new change, after the TG parser returns, we will detect that one of more asserts have failed, and avoid running any backend altogether, which is a better UE IMO (instead of seeing a crash and a stack trace). 

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


More information about the llvm-commits mailing list