diff options
author | Fangrui Song <maskray@google.com> | 2019-06-21 05:40:31 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-06-21 05:40:31 +0000 |
commit | dc8de6037c3aceb9663c7433bb09584fa8571032 (patch) | |
tree | acb49acaa3d1a0428951451a091fcb4d0c79a464 /llvm/lib/Analysis/ProfileSummaryInfo.cpp | |
parent | d5e1ce3f44b0bef1eadbef9828b87a8918a82669 (diff) | |
download | bcm5719-llvm-dc8de6037c3aceb9663c7433bb09584fa8571032.tar.gz bcm5719-llvm-dc8de6037c3aceb9663c7433bb09584fa8571032.zip |
Simplify std::lower_bound with llvm::{bsearch,lower_bound}. NFC
llvm-svn: 364006
Diffstat (limited to 'llvm/lib/Analysis/ProfileSummaryInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/ProfileSummaryInfo.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
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<int> 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()) |