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

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 12:04:30 PDT 2023


asbirlea added a comment.

I **thought** the zero count is from the most significant bit but I may be wrong. In any case, your point is valid. I see how you can construct an example where the .first fields are not equal, but then the popcount and countl_zero are both equal, leading to a "false" on the LessThan call for both (a,b) and (b,a) comparison.
The change proposed here does provide an absolute ordering so it resolves the issue you found and it's reasonable to go with it. I'm not sure it's the "desired" one (or if it even matters). It will rely more often on the Idx default, than on the two comparisons, and perhaps that's ok. 
A more classical comparison would be for `LessThan` to provide a full `<`; so comparing on the .first for equivalency, but then determining the follow up on conditions which defines a strict ordering (e.g. `bitsToDouble()`?).

I would appreciate a code owner chiming in on whether there's a preferred resolution.


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