diff --git a/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h b/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h index 187642257cc52..19ec35c947c19 100644 --- a/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h +++ b/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h @@ -234,11 +234,8 @@ inline bool operator!=(const FunctionInfo &LHS, const FunctionInfo &RHS) { /// the GSYM file. inline bool operator<(const FunctionInfo &LHS, const FunctionInfo &RHS) { // First sort by address range - if (LHS.Range != RHS.Range) - return LHS.Range < RHS.Range; - if (LHS.Inline == RHS.Inline) - return LHS.OptLineTable < RHS.OptLineTable; - return LHS.Inline < RHS.Inline; + return std::tie(LHS.Range, LHS.Inline, LHS.OptLineTable) < + std::tie(RHS.Range, RHS.Inline, RHS.OptLineTable); } raw_ostream &operator<<(raw_ostream &OS, const FunctionInfo &R); diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h index e97c890ce9135..73c6d57f107f7 100644 --- a/llvm/include/llvm/MC/MCContext.h +++ b/llvm/include/llvm/MC/MCContext.h @@ -259,13 +259,9 @@ class MCContext { SelectionKey(SelectionKey), UniqueID(UniqueID) {} bool operator<(const COFFSectionKey &Other) const { - if (SectionName != Other.SectionName) - return SectionName < Other.SectionName; - if (GroupName != Other.GroupName) - return GroupName < Other.GroupName; - if (SelectionKey != Other.SelectionKey) - return SelectionKey < Other.SelectionKey; - return UniqueID < Other.UniqueID; + return std::tie(SectionName, GroupName, SelectionKey, UniqueID) < + std::tie(Other.SectionName, Other.GroupName, Other.SelectionKey, + Other.UniqueID); } }; @@ -279,11 +275,8 @@ class MCContext { : SectionName(SectionName), GroupName(GroupName), UniqueID(UniqueID) {} bool operator<(const WasmSectionKey &Other) const { - if (SectionName != Other.SectionName) - return SectionName < Other.SectionName; - if (GroupName != Other.GroupName) - return GroupName < Other.GroupName; - return UniqueID < Other.UniqueID; + return std::tie(SectionName, GroupName, UniqueID) < + std::tie(Other.SectionName, Other.GroupName, Other.UniqueID); } }; diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index a72c1d329e199..8b843634600be 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -10909,9 +10909,7 @@ struct AAPotentialValuesImpl : AAPotentialValues { return II.I == I && II.S == S; }; bool operator<(const ItemInfo &II) const { - if (I == II.I) - return S < II.S; - return I < II.I; + return std::tie(I, S) < std::tie(II.I, II.S); }; };