diff --git a/llvm/include/llvm/Support/InstructionCost.h b/llvm/include/llvm/Support/InstructionCost.h index d5f7457e04748..8e8aa6cfd717b 100644 --- a/llvm/include/llvm/Support/InstructionCost.h +++ b/llvm/include/llvm/Support/InstructionCost.h @@ -20,6 +20,7 @@ #include "llvm/Support/MathExtras.h" #include +#include namespace llvm { @@ -191,9 +192,7 @@ class InstructionCost { /// the states are valid and users can test for validity of the cost /// explicitly. bool operator<(const InstructionCost &RHS) const { - if (State != RHS.State) - return State < RHS.State; - return Value < RHS.Value; + return std::tie(State, Value) < std::tie(RHS.State, RHS.Value); } bool operator==(const InstructionCost &RHS) const { diff --git a/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp b/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp index bc51b293b5dda..f38e7b879e5f0 100644 --- a/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp +++ b/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp @@ -107,11 +107,7 @@ namespace { return !operator==(R); } bool operator<(const OffsetRange &R) const { - if (Min != R.Min) - return Min < R.Min; - if (Max != R.Max) - return Max < R.Max; - return Align < R.Align; + return std::tie(Min, Max, Align) < std::tie(R.Min, R.Max, R.Align); } static OffsetRange zero() { return {0, 0, 1}; } };