From 6e17bb78bae19a9e2462aa0542eea5d0e3cf7478 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper@gmail.com>
Date: Sat, 17 Oct 2015 16:37:09 +0000
Subject: [PATCH] Use binary search in isCPUStringValid since the array is
 sorted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250613 91177308-0d34-0410-b5e6-96231b3b80d8
---
 include/llvm/MC/MCSubtargetInfo.h | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

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