forked from OSchip/llvm-project
Use binary search in isCPUStringValid since the array is sorted.
llvm-svn: 250613
This commit is contained in:
parent
a18ae9bd70
commit
84c571c962
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue