Use std::is_sorted to replace a custom version. Also replace a comparison predicate...
authorCraig Topper <craig.topper@gmail.com>
Sat, 17 Oct 2015 21:32:26 +0000 (21:32 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 17 Oct 2015 21:32:26 +0000 (21:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250623 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsCCState.cpp
lib/Target/Mips/MipsISelLowering.h

index 7fc364c0eb4d84d88b24dff3c1309fc17631e146..d82063e3d2a943fde67932f6a2d593e4d56f5ffa 100644 (file)
@@ -29,17 +29,11 @@ static bool isF128SoftLibCall(const char *CallSym) {
       "powl",          "rintl",        "sinl",          "sqrtl",
       "truncl"};
 
       "powl",          "rintl",        "sinl",          "sqrtl",
       "truncl"};
 
-  const char *const *End = LibCalls + array_lengthof(LibCalls);
-
   // Check that LibCalls is sorted alphabetically.
   // Check that LibCalls is sorted alphabetically.
-  MipsTargetLowering::LTStr Comp;
-
-#ifndef NDEBUG
-  for (const char *const *I = LibCalls; I < End - 1; ++I)
-    assert(Comp(*I, *(I + 1)));
-#endif
-
-  return std::binary_search(LibCalls, End, CallSym, Comp);
+  auto Comp = [](const char *S1, const char *S2) { return strcmp(S1, S2) < 0; };
+  assert(std::is_sorted(std::begin(LibCalls), std::end(LibCalls), Comp));
+  return std::binary_search(std::begin(LibCalls), std::end(LibCalls),
+                            CallSym, Comp);
 }
 
 /// This function returns true if Ty is fp128, {f128} or i128 which was
 }
 
 /// This function returns true if Ty is fp128, {f128} or i128 which was
index b0204ca516d53de6e94e21aceb64756710a0069b..632eefd6009fb3243fec6015b976d22c9f1c4da6 100644 (file)
@@ -258,12 +258,6 @@ namespace llvm {
     EmitInstrWithCustomInserter(MachineInstr *MI,
                                 MachineBasicBlock *MBB) const override;
 
     EmitInstrWithCustomInserter(MachineInstr *MI,
                                 MachineBasicBlock *MBB) const override;
 
-    struct LTStr {
-      bool operator()(const char *S1, const char *S2) const {
-        return strcmp(S1, S2) < 0;
-      }
-    };
-
     void HandleByVal(CCState *, unsigned &, unsigned) const override;
 
     unsigned getRegisterByName(const char* RegName, EVT VT,
     void HandleByVal(CCState *, unsigned &, unsigned) const override;
 
     unsigned getRegisterByName(const char* RegName, EVT VT,