[llvm-commits] [llvm] r149549 - /llvm/trunk/utils/TableGen/CodeGenRegisters.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Feb 1 14:19:26 PST 2012


Author: stoklund
Date: Wed Feb  1 16:19:26 2012
New Revision: 149549

URL: http://llvm.org/viewvc/llvm-project?rev=149549&view=rev
Log:
Fix a bug in the TopoOrderRC comparison function.

The final tie breaker comparison also needs to return +/-1, or 0.
This is not a less() function.

This could cause otherwise identical super-classes to be ordered
unstably, depending on what the system qsort routine does with a bad
compare function.

Modified:
    llvm/trunk/utils/TableGen/CodeGenRegisters.cpp

Modified: llvm/trunk/utils/TableGen/CodeGenRegisters.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenRegisters.cpp?rev=149549&r1=149548&r2=149549&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenRegisters.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenRegisters.cpp Wed Feb  1 16:19:26 2012
@@ -503,7 +503,7 @@
     return 1;
 
   // Finally order by name as a tie breaker.
-  return A->getName() < B->getName();
+  return StringRef(A->getName()).compare(B->getName());
 }
 
 std::string CodeGenRegisterClass::getQualifiedName() const {





More information about the llvm-commits mailing list