]> granicus.if.org Git - llvm/commitdiff
Add tie-breaker for register class sorting in getSuperRegForSubReg
authorJessica Paquette <jpaquette@apple.com>
Wed, 28 Aug 2019 22:03:05 +0000 (22:03 +0000)
committerJessica Paquette <jpaquette@apple.com>
Wed, 28 Aug 2019 22:03:05 +0000 (22:03 +0000)
llvm::stable_sort is apparently not sufficient.

Use the same tie-breaker/sorting style as TopoOrderRC fix bot failures.

E.g.

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/19401/steps/test-check-all/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370267 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/CodeGenTarget.cpp

index 14822024505ce4037452fd0c83c6ac766fe4a417..52a6bcd58bea58885189d3b96f1ac19bb915cbe0 100644 (file)
@@ -329,7 +329,14 @@ CodeGenTarget::getSuperRegForSubReg(const ValueTypeByHwMode &ValueTy,
   // Find and return the largest of our candidate classes.
   llvm::stable_sort(Candidates, [&](const CodeGenRegisterClass *A,
                                     const CodeGenRegisterClass *B) {
-    return A->getMembers().size() > B->getMembers().size();
+    if (A->getMembers().size() > B->getMembers().size())
+      return true;
+
+    if (A->getMembers().size() < B->getMembers().size())
+      return false;
+
+    // Order by name as a tie-breaker.
+    return StringRef(A->getName()) < B->getName();
   });
 
   return Candidates[0];