[llvm] [TableGen][RISCV] Avoid using operator< on bools in SearchableTable lookup functions. (PR #182553)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 20 09:49:16 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-tablegen

Author: Craig Topper (topperc)

<details>
<summary>Changes</summary>

Hoping this makes MSVC happy.

Fixes #<!-- -->182485.

---
Full diff: https://github.com/llvm/llvm-project/pull/182553.diff


1 Files Affected:

- (modified) llvm/utils/TableGen/SearchableTableEmitter.cpp (+5) 


``````````diff
diff --git a/llvm/utils/TableGen/SearchableTableEmitter.cpp b/llvm/utils/TableGen/SearchableTableEmitter.cpp
index 88aa6bf8e9242..7dde130a9222a 100644
--- a/llvm/utils/TableGen/SearchableTableEmitter.cpp
+++ b/llvm/utils/TableGen/SearchableTableEmitter.cpp
@@ -491,6 +491,11 @@ void SearchableTableEmitter::emitLookupFunction(const GenericTable &Table,
         OS << "      if ((unsigned)LHS." << Field.Name << " > (unsigned)RHS."
            << Field.Name << ")\n";
         OS << "        return false;\n";
+      } else if (isa<BitRecTy>(Field.RecType)) {
+        // Avoid using operator< on bools to silence MSVC warning.
+        OS << "      if (LHS." << Field.Name << " != RHS." << Field.Name
+           << ")\n";
+        OS << "        return RHS." << Field.Name << ";\n";
       } else {
         OS << "      if (LHS." << Field.Name << " < RHS." << Field.Name
            << ")\n";

``````````

</details>


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


More information about the llvm-commits mailing list