[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
This commit is contained in:
Benjamin Kramer
2014-03-07 21:35:39 +00:00
parent 856eb29a6a
commit e1362f1ebd
7 changed files with 33 additions and 62 deletions

View File

@@ -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;