Skip to content

Commit 6c31984

Browse files
[llvm] Use std::tie to implement operator< (NFC) (#139391)
1 parent 0159eb6 commit 6c31984

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

llvm/include/llvm/Support/InstructionCost.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "llvm/Support/MathExtras.h"
2222
#include <limits>
23+
#include <tuple>
2324

2425
namespace llvm {
2526

@@ -191,9 +192,7 @@ class InstructionCost {
191192
/// the states are valid and users can test for validity of the cost
192193
/// explicitly.
193194
bool operator<(const InstructionCost &RHS) const {
194-
if (State != RHS.State)
195-
return State < RHS.State;
196-
return Value < RHS.Value;
195+
return std::tie(State, Value) < std::tie(RHS.State, RHS.Value);
197196
}
198197

199198
bool operator==(const InstructionCost &RHS) const {

llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,7 @@ namespace {
107107
return !operator==(R);
108108
}
109109
bool operator<(const OffsetRange &R) const {
110-
if (Min != R.Min)
111-
return Min < R.Min;
112-
if (Max != R.Max)
113-
return Max < R.Max;
114-
return Align < R.Align;
110+
return std::tie(Min, Max, Align) < std::tie(R.Min, R.Max, R.Align);
115111
}
116112
static OffsetRange zero() { return {0, 0, 1}; }
117113
};

0 commit comments

Comments
 (0)