Skip to content

Commit bfe1c28

Browse files
author
Mandeep Singh Grang
committed
[LTO] Change std::sort to llvm::sort in response to r327219
Summary: r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort. Refer D44363 for a list of all the required patches. Reviewers: pcc, mehdi_amini, ruiu Reviewed By: ruiu Subscribers: ruiu, inglorion, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D45137 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330053 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 069de1b commit bfe1c28

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/LTO/ThinLTOCodeGenerator.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -947,12 +947,12 @@ void ThinLTOCodeGenerator::run() {
947947
std::vector<int> ModulesOrdering;
948948
ModulesOrdering.resize(Modules.size());
949949
std::iota(ModulesOrdering.begin(), ModulesOrdering.end(), 0);
950-
std::sort(ModulesOrdering.begin(), ModulesOrdering.end(),
951-
[&](int LeftIndex, int RightIndex) {
952-
auto LSize = Modules[LeftIndex].getBuffer().size();
953-
auto RSize = Modules[RightIndex].getBuffer().size();
954-
return LSize > RSize;
955-
});
950+
llvm::sort(ModulesOrdering.begin(), ModulesOrdering.end(),
951+
[&](int LeftIndex, int RightIndex) {
952+
auto LSize = Modules[LeftIndex].getBuffer().size();
953+
auto RSize = Modules[RightIndex].getBuffer().size();
954+
return LSize > RSize;
955+
});
956956

957957
// Parallel optimizer + codegen
958958
{

0 commit comments

Comments
 (0)