[PATCH] D157955: [TableGen] Make OpcodeMappings sort comparator strict weak ordering compliant

Danila Kutenin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 08:56:45 PDT 2023


danlark added a comment.

In D157955#4625396 <https://reviews.llvm.org/D157955#4625396>, @aeubanks wrote:

> I'm also not seeing where the issue is with the current code

Comparator checks that `if (LhsMasks.first != RhsMasks.first)` and then compares by popcount and left bit. We can construct an example where transitivity of equivalence is broken, for example different masks with the same popcount and left bit

a = (1010, 0000)
b = (0110, 1010)
c = (1010, 1111)

`a < b` is false, `b < a` is false (left bit counts from right)
`b < c` is false, `c < b` is false

But `a < c` because .first are equal and popcount of .second of c is bigger


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157955/new/

https://reviews.llvm.org/D157955



More information about the llvm-commits mailing list