[PATCH] D87597: [TableGen] Fix invalid comparison function `SizeOrder` in `getMatchingSubClassWithSubRegs`

Ta-Wei Tu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 13 23:14:18 PDT 2020


TaWeiTu created this revision.
TaWeiTu added reviewers: arsenm, dsanders.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
TaWeiTu requested review of this revision.
Herald added a subscriber: wdng.

Building LLVM with `-DEXPENSIVE_CHECKS` fails with the following error message with libstdc++ in debug mode:

  Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)).

The patch fixes the comparison function `SizeOrder` by returning `false` when comparing two equal items.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87597

Files:
  llvm/utils/TableGen/CodeGenRegisters.cpp


Index: llvm/utils/TableGen/CodeGenRegisters.cpp
===================================================================
--- llvm/utils/TableGen/CodeGenRegisters.cpp
+++ llvm/utils/TableGen/CodeGenRegisters.cpp
@@ -999,6 +999,8 @@
                       const CodeGenRegisterClass *B) {
     // If there are multiple, identical register classes, prefer the original
     // register class.
+    if (A == B)
+      return false;
     if (A->getMembers().size() == B->getMembers().size())
       return A == this;
     return A->getMembers().size() > B->getMembers().size();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87597.291495.patch
Type: text/x-patch
Size: 568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200914/311b6948/attachment.bin>


More information about the llvm-commits mailing list