[lld] r248063 - COFF: Use parallel_sort in Writer::sortExceptionTable().

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 16:17:35 PDT 2015


Author: ruiu
Date: Fri Sep 18 18:17:34 2015
New Revision: 248063

URL: http://llvm.org/viewvc/llvm-project?rev=248063&view=rev
Log:
COFF: Use parallel_sort in Writer::sortExceptionTable().

This patch saves 4 ms out of 5 ms. Very small improvement,
but maybe better than nothing.

Modified:
    lld/trunk/COFF/Writer.cpp

Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=248063&r1=248062&r2=248063&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Fri Sep 18 18:17:34 2015
@@ -724,14 +724,16 @@ void Writer::sortExceptionTable() {
   uint8_t *End = Begin + Sec->getVirtualSize();
   if (Config->Machine == AMD64) {
     struct Entry { ulittle32_t Begin, End, Unwind; };
-    std::sort((Entry *)Begin, (Entry *)End,
-              [](const Entry &A, const Entry &B) { return A.Begin < B.Begin; });
+    parallel_sort(
+        (Entry *)Begin, (Entry *)End,
+        [](const Entry &A, const Entry &B) { return A.Begin < B.Begin; });
     return;
   }
   if (Config->Machine == ARMNT) {
     struct Entry { ulittle32_t Begin, Unwind; };
-    std::sort((Entry *)Begin, (Entry *)End,
-              [](const Entry &A, const Entry &B) { return A.Begin < B.Begin; });
+    parallel_sort(
+        (Entry *)Begin, (Entry *)End,
+        [](const Entry &A, const Entry &B) { return A.Begin < B.Begin; });
     return;
   }
   errs() << "warning: don't know how to handle .pdata.\n";




More information about the llvm-commits mailing list