[llvm] [TableGen] Extend direct lookup to instruction values in generic tables. (PR #80486)

Piotr Sobczak via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 03:21:06 PST 2024


piotrAMD wrote:

Looks the code assumes that `Index.Fields[0].Enum` and `Index.Fields[0].IsInstruction` are exclusive. 

This is not universally true. For example `WMMAOpcode2AddrMappingTable` in AMDGPU target has both of them set.

This can cause problems, because `SearchableTableEmitter::compareBy()` or `primaryRepresentation()` check `IsInstruction` first and `Enum` next, but `SearchableTableEmitter::getNumericKey()` checks `Enum` first and `IsInstruction` next.

An immediate fix for that issue would be to switch the conditions around in `getNumericKey` so it checks `Instruction` before checking `Enum` maintainig consistency. Not sure how future-proof that would be, though.

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


More information about the llvm-commits mailing list