summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/Reassociate.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-04-23 14:51:27 +0000
committerFangrui Song <maskray@google.com>2019-04-23 14:51:27 +0000
commitefd94c56badf696ed7193f4a83c7a59f7dfbfc6e (patch)
tree63f7a8a57c367cf6ba845a80eda9177b62c516be /llvm/lib/Transforms/Scalar/Reassociate.cpp
parent99cf58339fceadee43ba3fdbf962a083cd5af6c4 (diff)
downloadbcm5719-llvm-efd94c56badf696ed7193f4a83c7a59f7dfbfc6e.tar.gz
bcm5719-llvm-efd94c56badf696ed7193f4a83c7a59f7dfbfc6e.zip
Use llvm::stable_sort
While touching the code, simplify if feasible. llvm-svn: 358996
Diffstat (limited to 'llvm/lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/Reassociate.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp
index 34066aea27d..7cdfce84559 100644
--- a/llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp
@@ -1328,8 +1328,7 @@ Value *ReassociatePass::OptimizeXor(Instruction *I,
// So, if Rank(X) < Rank(Y) < Rank(Z), it means X is defined earlier
// than Y which is defined earlier than Z. Permute "x | 1", "Y & 2",
// "z" in the order of X-Y-Z is better than any other orders.
- std::stable_sort(OpndPtrs.begin(), OpndPtrs.end(),
- [](XorOpnd *LHS, XorOpnd *RHS) {
+ llvm::stable_sort(OpndPtrs, [](XorOpnd *LHS, XorOpnd *RHS) {
return LHS->getSymbolicRank() < RHS->getSymbolicRank();
});
@@ -1686,8 +1685,7 @@ static bool collectMultiplyFactors(SmallVectorImpl<ValueEntry> &Ops,
// below our mininum of '4'.
assert(FactorPowerSum >= 4);
- std::stable_sort(Factors.begin(), Factors.end(),
- [](const Factor &LHS, const Factor &RHS) {
+ llvm::stable_sort(Factors, [](const Factor &LHS, const Factor &RHS) {
return LHS.Power > RHS.Power;
});
return true;
@@ -2141,7 +2139,7 @@ void ReassociatePass::ReassociateExpression(BinaryOperator *I) {
// positions maintained (and so the compiler is deterministic). Note that
// this sorts so that the highest ranking values end up at the beginning of
// the vector.
- std::stable_sort(Ops.begin(), Ops.end());
+ llvm::stable_sort(Ops);
// Now that we have the expression tree in a convenient
// sorted form, optimize it globally if possible.
OpenPOWER on IntegriCloud