From: Benjamin Kramer Date: Mon, 29 Jun 2015 16:05:00 +0000 (+0000) Subject: [SymbolSize] Skip sorting by index, just assign by index. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=59a20ece84158676b2afa8ac43306172b453d14d [SymbolSize] Skip sorting by index, just assign by index. No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240961 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Object/SymbolSize.cpp b/lib/Object/SymbolSize.cpp index 730e54cf330..1d5cd78e6d9 100644 --- a/lib/Object/SymbolSize.cpp +++ b/lib/Object/SymbolSize.cpp @@ -31,10 +31,6 @@ static int compareAddress(const SymEntry *A, const SymEntry *B) { return A->Address - B->Address; } -static int compareNumber(const SymEntry *A, const SymEntry *B) { - return A->Number - B->Number; -} - static unsigned getSectionID(const ObjectFile &O, SectionRef Sec) { if (auto *M = dyn_cast(&O)) return M->getSectionID(Sec); @@ -93,12 +89,12 @@ llvm::object::computeSymbolSizes(const ObjectFile &O) { P.Address = Size; } - // Put back in the original order and copy the result - array_pod_sort(Addresses.begin(), Addresses.end(), compareNumber); + // Assign the sorted symbols in the original order. + Ret.resize(SymNum); for (SymEntry &P : Addresses) { if (P.I == O.symbol_end()) continue; - Ret.push_back({*P.I, P.Address}); + Ret[P.Number] = {*P.I, P.Address}; } return Ret; }