diff --git a/llvm/include/llvm/MC/MCSubtargetInfo.h b/llvm/include/llvm/MC/MCSubtargetInfo.h index d5ad4eebf9ef..30dfa1999e61 100644 --- a/llvm/include/llvm/MC/MCSubtargetInfo.h +++ b/llvm/include/llvm/MC/MCSubtargetInfo.h @@ -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; } };