[lld] b578f13 - [COFF] Stabilize sort

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 28 13:41:22 PDT 2020


Author: Benjamin Kramer
Date: 2020-03-28T21:38:50+01:00
New Revision: b578f130a72f574f6ca5ae4fd5eda141bb5f4472

URL: https://github.com/llvm/llvm-project/commit/b578f130a72f574f6ca5ae4fd5eda141bb5f4472
DIFF: https://github.com/llvm/llvm-project/commit/b578f130a72f574f6ca5ae4fd5eda141bb5f4472.diff

LOG: [COFF] Stabilize sort

Found by llvm::sort's expensive checks.

Added: 
    

Modified: 
    lld/COFF/PDB.cpp

Removed: 
    


################################################################################
diff  --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index 3754bd0d1cf6..8ecfdca768a9 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -1385,6 +1385,8 @@ void PDBLinker::printStats() {
       TypeIndex typeIndex;
       uint64_t totalInputSize() const { return uint64_t(dupCount) * typeSize; }
       bool operator<(const TypeSizeInfo &rhs) const {
+        if (totalInputSize() == rhs.totalInputSize())
+          return typeIndex < rhs.typeIndex;
         return totalInputSize() < rhs.totalInputSize();
       }
     };


        


More information about the llvm-commits mailing list