No need to do an expensive stable sort for a bunch of integers.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 26 Mar 2012 14:17:26 +0000 (14:17 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 26 Mar 2012 14:17:26 +0000 (14:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153438 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp

index 8370f5f0fc73e875e456acca10cd0bcdcfe564e4..660684d1bea53a6a965150e24c2a9851334ed06b 100644 (file)
@@ -15,6 +15,7 @@
 #include "DwarfDebug.h"
 #include "DIE.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCStreamer.h"
@@ -68,11 +69,10 @@ void DwarfAccelTable::AddName(StringRef Name, DIE* die, char Flags) {
 
 void DwarfAccelTable::ComputeBucketCount(void) {
   // First get the number of unique hashes.
-  std::vector<uint32_t> uniques;
-  uniques.resize(Data.size());
+  std::vector<uint32_t> uniques(Data.size());
   for (size_t i = 0, e = Data.size(); i < e; ++i)
     uniques[i] = Data[i]->HashValue;
-  std::stable_sort(uniques.begin(), uniques.end());
+  array_pod_sort(uniques.begin(), uniques.end());
   std::vector<uint32_t>::iterator p =
     std::unique(uniques.begin(), uniques.end());
   uint32_t num = std::distance(uniques.begin(), p);