[llvm] [NFC][TableGen] Minor code cleanup in SearchableTableEmitter (PR #147856)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 08:55:53 PDT 2025


================
@@ -232,67 +235,74 @@ int64_t SearchableTableEmitter::getNumericKey(const SearchIndex &Index,
 /// key of \p Index.
 bool SearchableTableEmitter::compareBy(const Record *LHS, const Record *RHS,
                                        const SearchIndex &Index) {
-  for (const auto &Field : Index.Fields) {
-    const Init *LHSI = LHS->getValueInit(Field.Name);
-    const Init *RHSI = RHS->getValueInit(Field.Name);
+  // Compare two values and return:
+  // true if LHS < RHS
+  // false if  LHS > RHS
+  // std::nullopt if LHS == RHS
+  auto CmpLTValue = [](const auto &LHS,
+                       const auto &RHS) -> std::optional<bool> {
+    if (LHS < RHS)
----------------
jurahul wrote:

Fixed. We now do a single compare() for strings

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


More information about the llvm-commits mailing list