diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-07 21:35:39 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-07 21:35:39 +0000 |
commit | e1362f1ebd3c10326e1d12514f3172201f91d832 (patch) | |
tree | b3197de6c0c68500d1a51ef43ec86357fa07a77b /lib/Analysis/ScalarEvolutionExpander.cpp | |
parent | 856eb29a6a62a73be41396aa695247656b95dea6 (diff) | |
download | llvm-e1362f1ebd3c10326e1d12514f3172201f91d832.tar.gz llvm-e1362f1ebd3c10326e1d12514f3172201f91d832.tar.bz2 llvm-e1362f1ebd3c10326e1d12514f3172201f91d832.tar.xz |
[C++11] Convert sort predicates into lambdas.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203288 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolutionExpander.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index ed345ab115..3602d1d442 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -1674,15 +1674,6 @@ SCEVExpander::getOrInsertCanonicalInductionVariable(const Loop *L, return V; } -/// Sort values by integer width for replaceCongruentIVs. -static bool width_descending(Value *lhs, Value *rhs) { - // Put pointers at the back and make sure pointer < pointer = false. - if (!lhs->getType()->isIntegerTy() || !rhs->getType()->isIntegerTy()) - return rhs->getType()->isIntegerTy() && !lhs->getType()->isIntegerTy(); - return rhs->getType()->getPrimitiveSizeInBits() - < lhs->getType()->getPrimitiveSizeInBits(); -} - /// replaceCongruentIVs - Check for congruent phis in this loop header and /// replace them with their most canonical representative. Return the number of /// phis eliminated. @@ -1699,7 +1690,13 @@ unsigned SCEVExpander::replaceCongruentIVs(Loop *L, const DominatorTree *DT, Phis.push_back(Phi); } if (TTI) - std::sort(Phis.begin(), Phis.end(), width_descending); + std::sort(Phis.begin(), Phis.end(), [](Value *LHS, Value *RHS) { + // Put pointers at the back and make sure pointer < pointer = false. + if (!LHS->getType()->isIntegerTy() || !RHS->getType()->isIntegerTy()) + return RHS->getType()->isIntegerTy() && !LHS->getType()->isIntegerTy(); + return RHS->getType()->getPrimitiveSizeInBits() < + LHS->getType()->getPrimitiveSizeInBits(); + }); unsigned NumElim = 0; DenseMap<const SCEV *, PHINode *> ExprToIVMap; |