Skip to content

[llvm] Use std::tie to implement comparison functors (NFC) #146197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/include/llvm/ProfileData/SampleProf.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ struct LineLocation {
LLVM_ABI void serialize(raw_ostream &OS);

bool operator<(const LineLocation &O) const {
return LineOffset < O.LineOffset ||
(LineOffset == O.LineOffset && Discriminator < O.Discriminator);
return std::tie(LineOffset, Discriminator) <
std::tie(O.LineOffset, O.Discriminator);
}

bool operator==(const LineLocation &O) const {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/Hexagon/HexagonBlockRanges.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct HexagonBlockRanges {
unsigned Sub;

bool operator<(RegisterRef R) const {
return Reg < R.Reg || (Reg == R.Reg && Sub < R.Sub);
return std::tie(Reg, Sub) < std::tie(R.Reg, R.Sub);
}
};
using RegisterSet = std::set<RegisterRef>;
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/X86/X86PreTileConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ struct MIRef {
bool operator<(const MIRef &RHS) const {
// Comparison between different BBs happens when inserting a MIRef into set.
// So we compare MBB first to make the insertion happy.
return MBB < RHS.MBB || (MBB == RHS.MBB && Pos < RHS.Pos);
return std::tie(MBB, Pos) < std::tie(RHS.MBB, RHS.Pos);
}
bool operator>(const MIRef &RHS) const {
// Comparison between different BBs happens when inserting a MIRef into set.
// So we compare MBB first to make the insertion happy.
return MBB > RHS.MBB || (MBB == RHS.MBB && Pos > RHS.Pos);
return std::tie(MBB, Pos) > std::tie(RHS.MBB, RHS.Pos);
}
};

Expand Down
Loading