Skip to content

Commit 6033a48

Browse files
[CodeGen] Use std::tie to implement a comparison functor (NFC) (#140088)
std::tie simplifies the lexicographical comparison while making the code a little more consistent within MIRPrinter.cpp as we have a very similar comparison functor in MIRPrinter::convertCalledGlobals, about 30 lines below the code this patch touches.
1 parent 18ecff4 commit 6033a48

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/CodeGen/MIRPrinter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,9 +575,8 @@ void MIRPrinter::convertCallSiteObjects(yaml::MachineFunction &YMF,
575575
// Sort call info by position of call instructions.
576576
llvm::sort(YMF.CallSitesInfo.begin(), YMF.CallSitesInfo.end(),
577577
[](yaml::CallSiteInfo A, yaml::CallSiteInfo B) {
578-
if (A.CallLocation.BlockNum == B.CallLocation.BlockNum)
579-
return A.CallLocation.Offset < B.CallLocation.Offset;
580-
return A.CallLocation.BlockNum < B.CallLocation.BlockNum;
578+
return std::tie(A.CallLocation.BlockNum, A.CallLocation.Offset) <
579+
std::tie(B.CallLocation.BlockNum, B.CallLocation.Offset);
581580
});
582581
}
583582

0 commit comments

Comments
 (0)