Use binary search in isCPUStringValid since the array is sorted.

llvm-svn: 250613
This commit is contained in:
Craig Topper 2015-10-17 16:37:09 +00:00
parent a18ae9bd70
commit 84c571c962
1 changed files with 2 additions and 5 deletions

View File

@ -159,11 +159,8 @@ public:
/// Check whether the CPU string is valid.
bool isCPUStringValid(StringRef CPU) const {
auto Found = std::find_if(ProcDesc.begin(), ProcDesc.end(),
[=](const SubtargetFeatureKV &KV) {
return CPU == KV.Key;
});
return Found != ProcDesc.end();
auto Found = std::lower_bound(ProcDesc.begin(), ProcDesc.end(), CPU);
return Found != ProcDesc.end() && StringRef(Found->Key) == CPU;
}
};