From dc8de6037c3aceb9663c7433bb09584fa8571032 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 21 Jun 2019 05:40:31 +0000 Subject: Simplify std::lower_bound with llvm::{bsearch,lower_bound}. NFC llvm-svn: 364006 --- llvm/lib/Analysis/ProfileSummaryInfo.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Analysis/ProfileSummaryInfo.cpp') diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp index 682f15d054d..52e015b5bb3 100644 --- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp +++ b/llvm/lib/Analysis/ProfileSummaryInfo.cpp @@ -60,10 +60,9 @@ static cl::opt ProfileSummaryColdCount( // Find the summary entry for a desired percentile of counts. static const ProfileSummaryEntry &getEntryForPercentile(SummaryEntryVector &DS, uint64_t Percentile) { - auto Compare = [](const ProfileSummaryEntry &Entry, uint64_t Percentile) { - return Entry.Cutoff < Percentile; - }; - auto It = std::lower_bound(DS.begin(), DS.end(), Percentile, Compare); + auto It = llvm::bsearch(DS, [=](const ProfileSummaryEntry &Entry) { + return Percentile <= Entry.Cutoff; + }); // The required percentile has to be <= one of the percentiles in the // detailed summary. if (It == DS.end()) -- cgit v1.2.3