[llvm] r328430 - [Hexagon] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 24 10:34:37 PDT 2018
Author: mgrang
Date: Sat Mar 24 10:34:37 2018
New Revision: 328430
URL: http://llvm.org/viewvc/llvm-project?rev=328430&view=rev
Log:
[Hexagon] 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: kparzysz
Reviewed By: kparzysz
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D44857
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonBlockRanges.cpp
llvm/trunk/lib/Target/Hexagon/HexagonConstExtenders.cpp
llvm/trunk/lib/Target/Hexagon/HexagonGenInsert.cpp
llvm/trunk/lib/Target/Hexagon/HexagonStoreWidening.cpp
llvm/trunk/lib/Target/Hexagon/RDFDeadCode.cpp
llvm/trunk/lib/Target/Hexagon/RDFGraph.cpp
llvm/trunk/lib/Target/Hexagon/RDFLiveness.cpp
Modified: llvm/trunk/lib/Target/Hexagon/HexagonBlockRanges.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonBlockRanges.cpp?rev=328430&r1=328429&r2=328430&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonBlockRanges.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonBlockRanges.cpp Sat Mar 24 10:34:37 2018
@@ -85,7 +85,7 @@ void HexagonBlockRanges::RangeList::unio
if (empty())
return;
- std::sort(begin(), end());
+ llvm::sort(begin(), end());
iterator Iter = begin();
while (Iter != end()-1) {
Modified: llvm/trunk/lib/Target/Hexagon/HexagonConstExtenders.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonConstExtenders.cpp?rev=328430&r1=328429&r2=328430&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonConstExtenders.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonConstExtenders.cpp Sat Mar 24 10:34:37 2018
@@ -1881,7 +1881,7 @@ bool HCE::runOnMachineFunction(MachineFu
AssignmentMap IMap;
collect(MF);
- std::sort(Extenders.begin(), Extenders.end(),
+ llvm::sort(Extenders.begin(), Extenders.end(),
[](const ExtDesc &A, const ExtDesc &B) {
return ExtValue(A) < ExtValue(B);
});
Modified: llvm/trunk/lib/Target/Hexagon/HexagonGenInsert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonGenInsert.cpp?rev=328430&r1=328429&r2=328430&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonGenInsert.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonGenInsert.cpp Sat Mar 24 10:34:37 2018
@@ -632,7 +632,7 @@ void HexagonGenInsert::buildOrderingBT(R
SortableVectorType VRs;
for (RegisterOrdering::iterator I = RB.begin(), E = RB.end(); I != E; ++I)
VRs.push_back(I->first);
- std::sort(VRs.begin(), VRs.end(), LexCmp);
+ llvm::sort(VRs.begin(), VRs.end(), LexCmp);
// Transfer the results to the outgoing register ordering.
for (unsigned i = 0, n = VRs.size(); i < n; ++i)
RO.insert(std::make_pair(VRs[i], i));
Modified: llvm/trunk/lib/Target/Hexagon/HexagonStoreWidening.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonStoreWidening.cpp?rev=328430&r1=328429&r2=328430&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonStoreWidening.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonStoreWidening.cpp Sat Mar 24 10:34:37 2018
@@ -578,7 +578,7 @@ bool HexagonStoreWidening::processBasicB
};
for (auto &G : SGs) {
assert(G.size() > 1 && "Store group with fewer than 2 elements");
- std::sort(G.begin(), G.end(), Less);
+ llvm::sort(G.begin(), G.end(), Less);
Changed |= processStoreGroup(G);
}
Modified: llvm/trunk/lib/Target/Hexagon/RDFDeadCode.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/RDFDeadCode.cpp?rev=328430&r1=328429&r2=328430&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/RDFDeadCode.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/RDFDeadCode.cpp Sat Mar 24 10:34:37 2018
@@ -214,7 +214,7 @@ bool DeadCodeElimination::erase(const Se
return false;
return A.Id < B.Id;
};
- std::sort(DRNs.begin(), DRNs.end(), UsesFirst);
+ llvm::sort(DRNs.begin(), DRNs.end(), UsesFirst);
if (trace())
dbgs() << "Removing dead ref nodes:\n";
Modified: llvm/trunk/lib/Target/Hexagon/RDFGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/RDFGraph.cpp?rev=328430&r1=328429&r2=328430&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/RDFGraph.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/RDFGraph.cpp Sat Mar 24 10:34:37 2018
@@ -1471,7 +1471,7 @@ void DataFlowGraph::buildPhis(BlockRefsM
// and add a def for each S in the closure.
// Sort the refs so that the phis will be created in a deterministic order.
- std::sort(MaxRefs.begin(), MaxRefs.end());
+ llvm::sort(MaxRefs.begin(), MaxRefs.end());
// Remove duplicates.
auto NewEnd = std::unique(MaxRefs.begin(), MaxRefs.end());
MaxRefs.erase(NewEnd, MaxRefs.end());
Modified: llvm/trunk/lib/Target/Hexagon/RDFLiveness.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/RDFLiveness.cpp?rev=328430&r1=328429&r2=328430&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/RDFLiveness.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/RDFLiveness.cpp Sat Mar 24 10:34:37 2018
@@ -207,7 +207,7 @@ NodeList Liveness::getAllReachingDefs(Re
};
std::vector<NodeId> Tmp(Owners.begin(), Owners.end());
- std::sort(Tmp.begin(), Tmp.end(), Less);
+ llvm::sort(Tmp.begin(), Tmp.end(), Less);
// The vector is a list of instructions, so that defs coming from
// the same instruction don't need to be artificially ordered.
@@ -813,7 +813,7 @@ void Liveness::computeLiveIns() {
std::vector<RegisterRef> LV;
for (auto I = B.livein_begin(), E = B.livein_end(); I != E; ++I)
LV.push_back(RegisterRef(I->PhysReg, I->LaneMask));
- std::sort(LV.begin(), LV.end());
+ llvm::sort(LV.begin(), LV.end());
dbgs() << printMBBReference(B) << "\t rec = {";
for (auto I : LV)
dbgs() << ' ' << Print<RegisterRef>(I, DFG);
@@ -824,7 +824,7 @@ void Liveness::computeLiveIns() {
const RegisterAggr &LG = LiveMap[&B];
for (auto I = LG.rr_begin(), E = LG.rr_end(); I != E; ++I)
LV.push_back(*I);
- std::sort(LV.begin(), LV.end());
+ llvm::sort(LV.begin(), LV.end());
dbgs() << "\tcomp = {";
for (auto I : LV)
dbgs() << ' ' << Print<RegisterRef>(I, DFG);
More information about the llvm-commits
mailing list