Use std::is_sorted to replace a custom version. Also replace a comparison predicate struct with a lambda.

llvm-svn: 250623
This commit is contained in:
Craig Topper 2015-10-17 21:32:26 +00:00
parent 01cb379fed
commit a833451173
2 changed files with 4 additions and 16 deletions

View File

@ -29,17 +29,11 @@ static bool isF128SoftLibCall(const char *CallSym) {
"powl", "rintl", "sinl", "sqrtl",
"truncl"};
const char *const *End = LibCalls + array_lengthof(LibCalls);
// 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

View File

@ -258,12 +258,6 @@ namespace llvm {
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,