[PATCH] D66498: [GlobalISel] Import patterns containing INSERT_SUBREG

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 13:12:35 PDT 2019


paquette marked an inline comment as done.
paquette added inline comments.


================
Comment at: llvm/trunk/utils/TableGen/CodeGenTarget.cpp:330
+  // Find and return the largest of our candidate classes.
+  llvm::sort(Candidates,
+             [&](const CodeGenRegisterClass *A, const CodeGenRegisterClass *B) {
----------------
mgrang wrote:
> If A and B have the same size then you would end up with a tie. This can result in non-deterministic sorting order. I guess you would need a tie breaker in that case.
> See https://llvm.org/docs/CodingStandards.html#beware-of-non-deterministic-sorting-order-of-equal-elements.
Yes, that was a bug. :) I switched it to `llvm::stable_sort` in r370084 to fix that. I think that's sufficient, and it's passing on the EXPENSIVE_CHECKS bots now as far as I can see.

(I believe that `getRegClasses()` is stable, so I think `llvm::stable_sort` should produce a deterministic result.)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66498





More information about the llvm-commits mailing list