[C++11] Convert sort predicates into lambdas.

No functionality change.

llvm-svn: 203288
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
index 0f97160..1ba9ac1 100644
--- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -2860,10 +2860,6 @@
   return true;
 }
 
-static int compareNames(Constant *const *A, Constant *const *B) {
-  return (*A)->getName().compare((*B)->getName());
-}
-
 static void setUsedInitializer(GlobalVariable &V,
                                SmallPtrSet<GlobalValue *, 8> Init) {
   if (Init.empty()) {
@@ -2882,7 +2878,10 @@
     UsedArray.push_back(Cast);
   }
   // Sort to get deterministic order.
-  array_pod_sort(UsedArray.begin(), UsedArray.end(), compareNames);
+  array_pod_sort(UsedArray.begin(), UsedArray.end(),
+                 [](Constant *const *A, Constant *const *B) {
+    return (*A)->getName().compare((*B)->getName());
+  });
   ArrayType *ATy = ArrayType::get(Int8PtrTy, UsedArray.size());
 
   Module *M = V.getParent();
diff --git a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
index 4940424..b441931 100644
--- a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
@@ -191,18 +191,6 @@
       CollectConstants(I);
 }
 
-/// \brief Compare function for sorting integer constants by type and by value
-/// within a type in ConstantMaps.
-static bool
-ConstantMapLessThan(const std::pair<ConstantInt *, ConstantCandidate> &LHS,
-                    const std::pair<ConstantInt *, ConstantCandidate> &RHS) {
-  if (LHS.first->getType() == RHS.first->getType())
-    return LHS.first->getValue().ult(RHS.first->getValue());
-  else
-    return LHS.first->getType()->getBitWidth() <
-           RHS.first->getType()->getBitWidth();
-}
-
 /// \brief Find the base constant within the given range and rebase all other
 /// constants with respect to the base constant.
 void ConstantHoisting::FindAndMakeBaseConstant(ConstantMapType::iterator S,
@@ -239,7 +227,14 @@
 /// an add from a common base constant.
 void ConstantHoisting::FindBaseConstants() {
   // Sort the constants by value and type. This invalidates the mapping.
-  std::sort(ConstantMap.begin(), ConstantMap.end(), ConstantMapLessThan);
+  std::sort(ConstantMap.begin(), ConstantMap.end(),
+            [](const std::pair<ConstantInt *, ConstantCandidate> &LHS,
+               const std::pair<ConstantInt *, ConstantCandidate> &RHS) {
+    if (LHS.first->getType() != RHS.first->getType())
+      return LHS.first->getType()->getBitWidth() <
+             RHS.first->getType()->getBitWidth();
+    return LHS.first->getValue().ult(RHS.first->getValue());
+  });
 
   // Simple linear scan through the sorted constant map for viable merge
   // candidates.