[llvm] [TableGen] Use consistent field kind checking in getNumericKey. (PR #83284)
Jason Eckhardt via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 29 08:59:47 PST 2024
================
@@ -215,12 +215,14 @@ int64_t SearchableTableEmitter::getNumericKey(const SearchIndex &Index,
Record *Rec) {
assert(Index.Fields.size() == 1);
- if (Index.Fields[0].Enum) {
- Record *EnumEntry = Rec->getValueAsDef(Index.Fields[0].Name);
- return Index.Fields[0].Enum->EntryMap[EnumEntry]->second;
- } else if (Index.Fields[0].IsInstruction) {
+ // To be consistent with compareBy and primaryRepresentation elsewhere,
+ // we check for IsInstruction before Enum-- these fields are not exclusive.
+ if (Index.Fields[0].IsInstruction) {
Record *TheDef = Rec->getValueAsDef(Index.Fields[0].Name);
return Target->getInstrIntValue(TheDef);
+ } else if (Index.Fields[0].Enum) {
----------------
nvjle wrote:
Done.
Could I trouble you or @wangpc-pp to merge on my behalf? Thank you.
https://github.com/llvm/llvm-project/pull/83284
More information about the llvm-commits
mailing list