[llvm] [TableGen] Add support for sparse direct-lookup tables (PR #201158)

Igor Wodiany via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 07:10:30 PDT 2026


IgWod wrote:

> > If the key is in range, you get a default initialized record, in the VOPD example: `(VOPDXYKey = 0, IsX = false, IsY = false)`. For an out-of-range key there is an assert in the lookup function. This is the most efficient implementation, but we probably could include extra checks to return nullptr in those cases; at the expense of more code.
> 
> I think we need to do _something_ here, otherwise the behaviour of looking up an undefined but in-range key will change depending on tablegen's heuristics of whether to generate a sparse table, which does not seem acceptable.

I have changed the behavior so now the lookup return `nullptr` for "empty" and out-of-range rows. I've also update the example in the description.

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


More information about the llvm-commits mailing list