summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-03-03 19:58:30 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-03-03 19:58:30 +0000
commitb2f034b85e001fd79617f2124560509583118c13 (patch)
tree9fc514eac26b2618a66f7c9c19a858f6f8c4bc62 /llvm/lib
parent23d72e8465f73c7fda4be0018092f0f7e8a21eea (diff)
downloadbcm5719-llvm-b2f034b85e001fd79617f2124560509583118c13.tar.gz
bcm5719-llvm-b2f034b85e001fd79617f2124560509583118c13.zip
[C++11] Use std::tie to simplify compare operators.
No functionality change. llvm-svn: 202751
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/RegAllocGreedy.cpp5
-rw-r--r--llvm/lib/IR/ConstantsContext.h27
-rw-r--r--llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp7
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp20
4 files changed, 16 insertions, 43 deletions
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index b8307c63b2f..b9cc2fec8dc 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -190,9 +190,8 @@ class RAGreedy : public MachineFunctionPass,
void setBrokenHints(unsigned NHints) { BrokenHints = NHints; }
bool operator<(const EvictionCost &O) const {
- if (BrokenHints != O.BrokenHints)
- return BrokenHints < O.BrokenHints;
- return MaxWeight < O.MaxWeight;
+ return std::tie(BrokenHints, MaxWeight) <
+ std::tie(O.BrokenHints, O.MaxWeight);
}
};
diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index 32bed95e212..64f835b005a 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -334,14 +334,10 @@ struct ExprMapKeyType {
this->indices == that.indices;
}
bool operator<(const ExprMapKeyType & that) const {
- if (this->opcode != that.opcode) return this->opcode < that.opcode;
- if (this->operands != that.operands) return this->operands < that.operands;
- if (this->subclassdata != that.subclassdata)
- return this->subclassdata < that.subclassdata;
- if (this->subclassoptionaldata != that.subclassoptionaldata)
- return this->subclassoptionaldata < that.subclassoptionaldata;
- if (this->indices != that.indices) return this->indices < that.indices;
- return false;
+ return std::tie(opcode, operands, subclassdata, subclassoptionaldata,
+ indices) <
+ std::tie(that.opcode, that.operands, that.subclassdata,
+ that.subclassoptionaldata, that.indices);
}
bool operator!=(const ExprMapKeyType& that) const {
@@ -369,17 +365,10 @@ struct InlineAsmKeyType {
this->asm_dialect == that.asm_dialect;
}
bool operator<(const InlineAsmKeyType& that) const {
- if (this->asm_string != that.asm_string)
- return this->asm_string < that.asm_string;
- if (this->constraints != that.constraints)
- return this->constraints < that.constraints;
- if (this->has_side_effects != that.has_side_effects)
- return this->has_side_effects < that.has_side_effects;
- if (this->is_align_stack != that.is_align_stack)
- return this->is_align_stack < that.is_align_stack;
- if (this->asm_dialect != that.asm_dialect)
- return this->asm_dialect < that.asm_dialect;
- return false;
+ return std::tie(asm_string, constraints, has_side_effects, is_align_stack,
+ asm_dialect) <
+ std::tie(that.asm_string, that.constraints, that.has_side_effects,
+ that.is_align_stack, that.asm_dialect);
}
bool operator!=(const InlineAsmKeyType& that) const {
diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
index d372ba22d6e..d1dbdb10284 100644
--- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -62,12 +62,7 @@ namespace {
/// Make RetOrArg comparable, so we can put it into a map.
bool operator<(const RetOrArg &O) const {
- if (F != O.F)
- return F < O.F;
- else if (Idx != O.Idx)
- return Idx < O.Idx;
- else
- return IsArg < O.IsArg;
+ return std::tie(F, Idx, IsArg) < std::tie(O.F, O.Idx, O.IsArg);
}
/// Make RetOrArg comparable, so we can easily iterate the multimap.
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 2e881e3d53a..5ab32d91f52 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -979,21 +979,11 @@ void Cost::Lose() {
/// operator< - Choose the lower cost.
bool Cost::operator<(const Cost &Other) const {
- if (NumRegs != Other.NumRegs)
- return NumRegs < Other.NumRegs;
- if (AddRecCost != Other.AddRecCost)
- return AddRecCost < Other.AddRecCost;
- if (NumIVMuls != Other.NumIVMuls)
- return NumIVMuls < Other.NumIVMuls;
- if (NumBaseAdds != Other.NumBaseAdds)
- return NumBaseAdds < Other.NumBaseAdds;
- if (ScaleCost != Other.ScaleCost)
- return ScaleCost < Other.ScaleCost;
- if (ImmCost != Other.ImmCost)
- return ImmCost < Other.ImmCost;
- if (SetupCost != Other.SetupCost)
- return SetupCost < Other.SetupCost;
- return false;
+ return std::tie(NumRegs, AddRecCost, NumIVMuls, NumBaseAdds, ScaleCost,
+ ImmCost, SetupCost) <
+ std::tie(Other.NumRegs, Other.AddRecCost, Other.NumIVMuls,
+ Other.NumBaseAdds, Other.ScaleCost, Other.ImmCost,
+ Other.SetupCost);
}
void Cost::print(raw_ostream &OS) const {
OpenPOWER on IntegriCloud