[llvm] r370267 - Add tie-breaker for register class sorting in getSuperRegForSubReg
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 28 15:03:05 PDT 2019
Author: paquette
Date: Wed Aug 28 15:03:05 2019
New Revision: 370267
URL: http://llvm.org/viewvc/llvm-project?rev=370267&view=rev
Log:
Add tie-breaker for register class sorting in getSuperRegForSubReg
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
Modified:
llvm/trunk/utils/TableGen/CodeGenTarget.cpp
Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=370267&r1=370266&r2=370267&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Wed Aug 28 15:03:05 2019
@@ -329,7 +329,14 @@ CodeGenTarget::getSuperRegForSubReg(cons
// 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];
More information about the llvm-commits
mailing list