Skip to content

Commit 47b9837

Browse files
[llvm] Use std::tie to implement comparison functors (NFC) (#141353)
1 parent 4788d5f commit 47b9837

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

llvm/lib/Transforms/IPO/SampleProfile.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -897,9 +897,7 @@ updateIDTMetaData(Instruction &Inst,
897897

898898
llvm::sort(NewCallTargets,
899899
[](const InstrProfValueData &L, const InstrProfValueData &R) {
900-
if (L.Count != R.Count)
901-
return L.Count > R.Count;
902-
return L.Value > R.Value;
900+
return std::tie(L.Count, L.Value) > std::tie(R.Count, R.Value);
903901
});
904902

905903
uint32_t MaxMDCount =

llvm/tools/llvm-exegesis/lib/SchedClassResolution.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,7 @@ getNonRedundantWriteProcRes(const MCSchedClassDesc &SCDesc,
6969
[](const ResourceMaskAndEntry &A, const ResourceMaskAndEntry &B) {
7070
unsigned popcntA = popcount(A.first);
7171
unsigned popcntB = popcount(B.first);
72-
if (popcntA < popcntB)
73-
return true;
74-
if (popcntA > popcntB)
75-
return false;
76-
return A.first < B.first;
72+
return std::tie(popcntA, A.first) < std::tie(popcntB, B.first);
7773
});
7874

7975
SmallVector<float, 32> ProcResUnitUsage(NumProcRes);

0 commit comments

Comments
 (0)