llvm.org GIT mirror llvm / b8bd144
[include] 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 the comments section in D44363 for a list of all the required patches. Reviewers: echristo, zturner, mzolotukhin, lhames Reviewed By: echristo Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45135 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328940 91177308-0d34-0410-b5e6-96231b3b80d8 Mandeep Singh Grang 2 years ago
6 changed file(s) with 18 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
571571
572572 template
573573 bool compareVectors(std::vector &BB1, std::vector &BB2) {
574 std::sort(BB1.begin(), BB1.end());
575 std::sort(BB2.begin(), BB2.end());
574 llvm::sort(BB1.begin(), BB1.end());
575 llvm::sort(BB2.begin(), BB2.end());
576576 return BB1 == BB2;
577577 }
578578
673673 idx2MBBMap.push_back(IdxMBBPair(startIdx, mbb));
674674
675675 renumberIndexes(newItr);
676 std::sort(idx2MBBMap.begin(), idx2MBBMap.end(), Idx2MBBCompare());
676 llvm::sort(idx2MBBMap.begin(), idx2MBBMap.end(), Idx2MBBCompare());
677677 }
678678
679679 /// \brief Free the resources that were required to maintain a SlotIndex.
543543 void InstrProfSymtab::finalizeSymtab() {
544544 if (Sorted)
545545 return;
546 std::sort(MD5NameMap.begin(), MD5NameMap.end(), less_first());
547 std::sort(MD5FuncMap.begin(), MD5FuncMap.end(), less_first());
548 std::sort(AddrToMD5Map.begin(), AddrToMD5Map.end(), less_first());
546 llvm::sort(MD5NameMap.begin(), MD5NameMap.end(), less_first());
547 llvm::sort(MD5FuncMap.begin(), MD5FuncMap.end(), less_first());
548 llvm::sort(AddrToMD5Map.begin(), AddrToMD5Map.end(), less_first());
549549 AddrToMD5Map.erase(std::unique(AddrToMD5Map.begin(), AddrToMD5Map.end()),
550550 AddrToMD5Map.end());
551551 Sorted = true;
12401240 Operations[{U.getTo(), U.getFrom()}] = int(i);
12411241 }
12421242
1243 std::sort(Result.begin(), Result.end(),
1244 [&Operations](const UpdateT &A, const UpdateT &B) {
1245 return Operations[{A.getFrom(), A.getTo()}] >
1246 Operations[{B.getFrom(), B.getTo()}];
1247 });
1243 llvm::sort(Result.begin(), Result.end(),
1244 [&Operations](const UpdateT &A, const UpdateT &B) {
1245 return Operations[{A.getFrom(), A.getTo()}] >
1246 Operations[{B.getFrom(), B.getTo()}];
1247 });
12481248 }
12491249
12501250 static void ApplyNextUpdate(DomTreeT &DT, BatchUpdateInfo &BUI) {
14291429 // Make a copy and sort it such that it is possible to check if there are
14301430 // no gaps between DFS numbers of adjacent children.
14311431 SmallVector Children(Node->begin(), Node->end());
1432 std::sort(Children.begin(), Children.end(),
1433 [](const TreeNodePtr Ch1, const TreeNodePtr Ch2) {
1434 return Ch1->getDFSNumIn() < Ch2->getDFSNumIn();
1435 });
1432 llvm::sort(Children.begin(), Children.end(),
1433 [](const TreeNodePtr Ch1, const TreeNodePtr Ch2) {
1434 return Ch1->getDFSNumIn() < Ch2->getDFSNumIn();
1435 });
14361436
14371437 auto PrintChildrenError = [Node, &Children, PrintNodeAndDFSNums](
14381438 const TreeNodePtr FirstCh, const TreeNodePtr SecondCh) {
117117 const Comparator &Comp, TaskGroup &TG, size_t Depth) {
118118 // Do a sequential sort for small inputs.
119119 if (std::distance(Start, End) < detail::MinParallelSize || Depth == 0) {
120 std::sort(Start, End, Comp);
120 llvm::sort(Start, End, Comp);
121121 return;
122122 }
123123
199199 const Comparator &Comp = Comparator()) {
200200 static_assert(is_execution_policy::value,
201201 "Invalid execution policy!");
202 std::sort(Start, End, Comp);
202 llvm::sort(Start, End, Comp);
203203 }
204204
205205 template
137137 }
138138 }
139139
140 std::sort(SetFlags.begin(), SetFlags.end(), &flagName);
140 llvm::sort(SetFlags.begin(), SetFlags.end(), &flagName);
141141
142142 startLine() << Label << " [ (" << hex(Value) << ")\n";
143143 for (const auto &Flag : SetFlags) {