COFF: Use parallel_sort in Writer::sortExceptionTable().

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

llvm-svn: 248063
This commit is contained in:
Rui Ueyama 2015-09-18 23:17:34 +00:00
parent 666892051c
commit 8197a4e0bf
1 changed files with 6 additions and 4 deletions

View File

@ -724,14 +724,16 @@ void Writer::sortExceptionTable() {
uint8_t *End = Begin + Sec->getVirtualSize(); uint8_t *End = Begin + Sec->getVirtualSize();
if (Config->Machine == AMD64) { if (Config->Machine == AMD64) {
struct Entry { ulittle32_t Begin, End, Unwind; }; struct Entry { ulittle32_t Begin, End, Unwind; };
std::sort((Entry *)Begin, (Entry *)End, parallel_sort(
[](const Entry &A, const Entry &B) { return A.Begin < B.Begin; }); (Entry *)Begin, (Entry *)End,
[](const Entry &A, const Entry &B) { return A.Begin < B.Begin; });
return; return;
} }
if (Config->Machine == ARMNT) { if (Config->Machine == ARMNT) {
struct Entry { ulittle32_t Begin, Unwind; }; struct Entry { ulittle32_t Begin, Unwind; };
std::sort((Entry *)Begin, (Entry *)End, parallel_sort(
[](const Entry &A, const Entry &B) { return A.Begin < B.Begin; }); (Entry *)Begin, (Entry *)End,
[](const Entry &A, const Entry &B) { return A.Begin < B.Begin; });
return; return;
} }
errs() << "warning: don't know how to handle .pdata.\n"; errs() << "warning: don't know how to handle .pdata.\n";