[lld] r227132 - Use parallel_sort in the LayoutPass.
Shankar Easwaran
shankare at codeaurora.org
Mon Jan 26 12:29:21 PST 2015
parallel_sort had some issue with building few tests in the LLVM test
project. Bigcheese will have more information on this.
Shankar Easwaran
On 1/26/2015 2:18 PM, Rui Ueyama wrote:
> Author: ruiu
> Date: Mon Jan 26 14:18:37 2015
> New Revision: 227132
>
> URL: http://llvm.org/viewvc/llvm-project?rev=227132&view=rev
> Log:
> Use parallel_sort in the LayoutPass.
>
> Time to link lld using lld improved from 5.7s to 5.4s on Windows.
> It's not a significant improvement but not bad for one-line change.
>
> This patch includes a bug fix for Parallel.h as the original code
> uses operator< instead of a compare function there.
>
> Modified:
> lld/trunk/include/lld/Core/Parallel.h
> lld/trunk/lib/Passes/LayoutPass.cpp
>
> Modified: lld/trunk/include/lld/Core/Parallel.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Parallel.h?rev=227132&r1=227131&r2=227132&view=diff
> ==============================================================================
> --- lld/trunk/include/lld/Core/Parallel.h (original)
> +++ lld/trunk/include/lld/Core/Parallel.h Mon Jan 26 14:18:37 2015
> @@ -221,8 +221,8 @@ void parallel_quick_sort(RandomAccessIte
> auto pivot = medianOf3(start, end, comp);
> // Move pivot to end.
> std::swap(*(end - 1), *pivot);
> - pivot = std::partition(start, end - 1, [end](decltype(*start) v) {
> - return v < *(end - 1);
> + pivot = std::partition(start, end - 1, [&comp, end](decltype(*start) v) {
> + return comp(v, *(end - 1));
> });
> // Move pivot to middle of partition.
> std::swap(*pivot, *(end - 1));
>
> Modified: lld/trunk/lib/Passes/LayoutPass.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/LayoutPass.cpp?rev=227132&r1=227131&r2=227132&view=diff
> ==============================================================================
> --- lld/trunk/lib/Passes/LayoutPass.cpp (original)
> +++ lld/trunk/lib/Passes/LayoutPass.cpp Mon Jan 26 14:18:37 2015
> @@ -9,6 +9,7 @@
>
> #include "lld/Passes/LayoutPass.h"
> #include "lld/Core/Instrumentation.h"
> +#include "lld/Core/Parallel.h"
> #include "llvm/ADT/Twine.h"
> #include "llvm/Support/Debug.h"
> #include <algorithm>
> @@ -534,7 +535,7 @@ void LayoutPass::perform(std::unique_ptr
> });
>
> std::vector<LayoutPass::SortKey> vec = decorate(atomRange);
> - std::sort(vec.begin(), vec.end(),
> + parallel_sort(vec.begin(), vec.end(),
> [&](const LayoutPass::SortKey &l, const LayoutPass::SortKey &r) -> bool {
> return compareAtoms(l, r, _customSorter);
> });
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation
More information about the llvm-commits
mailing list