mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
[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 llvm-svn: 328940
This commit is contained in:
parent
a27ce15ac9
commit
1157c3c5a3
@ -572,8 +572,8 @@ void LoopInfoBase<BlockT, LoopT>::print(raw_ostream &OS) const {
|
||||
|
||||
template <typename T>
|
||||
bool compareVectors(std::vector<T> &BB1, std::vector<T> &BB2) {
|
||||
std::sort(BB1.begin(), BB1.end());
|
||||
std::sort(BB2.begin(), BB2.end());
|
||||
llvm::sort(BB1.begin(), BB1.end());
|
||||
llvm::sort(BB2.begin(), BB2.end());
|
||||
return BB1 == BB2;
|
||||
}
|
||||
|
||||
|
@ -674,7 +674,7 @@ class raw_ostream;
|
||||
idx2MBBMap.push_back(IdxMBBPair(startIdx, mbb));
|
||||
|
||||
renumberIndexes(newItr);
|
||||
std::sort(idx2MBBMap.begin(), idx2MBBMap.end(), Idx2MBBCompare());
|
||||
llvm::sort(idx2MBBMap.begin(), idx2MBBMap.end(), Idx2MBBCompare());
|
||||
}
|
||||
|
||||
/// \brief Free the resources that were required to maintain a SlotIndex.
|
||||
|
@ -544,9 +544,9 @@ Error InstrProfSymtab::create(const NameIterRange &IterRange) {
|
||||
void InstrProfSymtab::finalizeSymtab() {
|
||||
if (Sorted)
|
||||
return;
|
||||
std::sort(MD5NameMap.begin(), MD5NameMap.end(), less_first());
|
||||
std::sort(MD5FuncMap.begin(), MD5FuncMap.end(), less_first());
|
||||
std::sort(AddrToMD5Map.begin(), AddrToMD5Map.end(), less_first());
|
||||
llvm::sort(MD5NameMap.begin(), MD5NameMap.end(), less_first());
|
||||
llvm::sort(MD5FuncMap.begin(), MD5FuncMap.end(), less_first());
|
||||
llvm::sort(AddrToMD5Map.begin(), AddrToMD5Map.end(), less_first());
|
||||
AddrToMD5Map.erase(std::unique(AddrToMD5Map.begin(), AddrToMD5Map.end()),
|
||||
AddrToMD5Map.end());
|
||||
Sorted = true;
|
||||
|
@ -1241,11 +1241,11 @@ struct SemiNCAInfo {
|
||||
Operations[{U.getTo(), U.getFrom()}] = int(i);
|
||||
}
|
||||
|
||||
std::sort(Result.begin(), Result.end(),
|
||||
[&Operations](const UpdateT &A, const UpdateT &B) {
|
||||
return Operations[{A.getFrom(), A.getTo()}] >
|
||||
Operations[{B.getFrom(), B.getTo()}];
|
||||
});
|
||||
llvm::sort(Result.begin(), Result.end(),
|
||||
[&Operations](const UpdateT &A, const UpdateT &B) {
|
||||
return Operations[{A.getFrom(), A.getTo()}] >
|
||||
Operations[{B.getFrom(), B.getTo()}];
|
||||
});
|
||||
}
|
||||
|
||||
static void ApplyNextUpdate(DomTreeT &DT, BatchUpdateInfo &BUI) {
|
||||
@ -1430,10 +1430,10 @@ struct SemiNCAInfo {
|
||||
// Make a copy and sort it such that it is possible to check if there are
|
||||
// no gaps between DFS numbers of adjacent children.
|
||||
SmallVector<TreeNodePtr, 8> Children(Node->begin(), Node->end());
|
||||
std::sort(Children.begin(), Children.end(),
|
||||
[](const TreeNodePtr Ch1, const TreeNodePtr Ch2) {
|
||||
return Ch1->getDFSNumIn() < Ch2->getDFSNumIn();
|
||||
});
|
||||
llvm::sort(Children.begin(), Children.end(),
|
||||
[](const TreeNodePtr Ch1, const TreeNodePtr Ch2) {
|
||||
return Ch1->getDFSNumIn() < Ch2->getDFSNumIn();
|
||||
});
|
||||
|
||||
auto PrintChildrenError = [Node, &Children, PrintNodeAndDFSNums](
|
||||
const TreeNodePtr FirstCh, const TreeNodePtr SecondCh) {
|
||||
|
@ -118,7 +118,7 @@ void parallel_quick_sort(RandomAccessIterator Start, RandomAccessIterator End,
|
||||
const Comparator &Comp, TaskGroup &TG, size_t Depth) {
|
||||
// Do a sequential sort for small inputs.
|
||||
if (std::distance(Start, End) < detail::MinParallelSize || Depth == 0) {
|
||||
std::sort(Start, End, Comp);
|
||||
llvm::sort(Start, End, Comp);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ void sort(Policy policy, RandomAccessIterator Start, RandomAccessIterator End,
|
||||
const Comparator &Comp = Comparator()) {
|
||||
static_assert(is_execution_policy<Policy>::value,
|
||||
"Invalid execution policy!");
|
||||
std::sort(Start, End, Comp);
|
||||
llvm::sort(Start, End, Comp);
|
||||
}
|
||||
|
||||
template <class Policy, class IterTy, class FuncTy>
|
||||
|
@ -138,7 +138,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(SetFlags.begin(), SetFlags.end(), &flagName<TFlag>);
|
||||
llvm::sort(SetFlags.begin(), SetFlags.end(), &flagName<TFlag>);
|
||||
|
||||
startLine() << Label << " [ (" << hex(Value) << ")\n";
|
||||
for (const auto &Flag : SetFlags) {
|
||||
|
Loading…
Reference in New Issue
Block a user