summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-06-21 05:40:31 +0000
committerFangrui Song <maskray@google.com>2019-06-21 05:40:31 +0000
commitdc8de6037c3aceb9663c7433bb09584fa8571032 (patch)
treeacb49acaa3d1a0428951451a091fcb4d0c79a464 /llvm/lib/Transforms
parentd5e1ce3f44b0bef1eadbef9828b87a8918a82669 (diff)
downloadbcm5719-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/Transforms')
-rw-r--r--llvm/lib/Transforms/Coroutines/CoroFrame.cpp2
-rw-r--r--llvm/lib/Transforms/Scalar/JumpThreading.cpp3
-rw-r--r--llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp4
-rw-r--r--llvm/lib/Transforms/Scalar/Reassociate.cpp2
4 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index 98f6ca24f97..174430da171 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -52,7 +52,7 @@ public:
}
size_t blockToIndex(BasicBlock *BB) const {
- auto *I = std::lower_bound(V.begin(), V.end(), BB);
+ auto *I = llvm::lower_bound(V, BB);
assert(I != V.end() && *I == BB && "BasicBlockNumberng: Unknown block");
return I - V.begin();
}
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index 7cb955d03ff..c80cdd08224 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -1480,8 +1480,7 @@ bool JumpThreadingPass::SimplifyPartiallyRedundantLoad(LoadInst *LoadI) {
for (pred_iterator PI = PB; PI != PE; ++PI) {
BasicBlock *P = *PI;
AvailablePredsTy::iterator I =
- std::lower_bound(AvailablePreds.begin(), AvailablePreds.end(),
- std::make_pair(P, (Value*)nullptr));
+ llvm::lower_bound(AvailablePreds, std::make_pair(P, (Value *)nullptr));
assert(I != AvailablePreds.end() && I->first == P &&
"Didn't find entry for predecessor!");
diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index eeeef58384d..cf852111283 100644
--- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -278,8 +278,8 @@ void MemsetRanges::addRange(int64_t Start, int64_t Size, Value *Ptr,
unsigned Alignment, Instruction *Inst) {
int64_t End = Start+Size;
- range_iterator I = std::lower_bound(Ranges.begin(), Ranges.end(), Start,
- [](const MemsetRange &LHS, int64_t RHS) { return LHS.End < RHS; });
+ range_iterator I = llvm::bsearch(
+ Ranges, [=](const MemsetRange &O) { return Start <= O.End; });
// We now know that I == E, in which case we didn't find anything to merge
// with, or that Start <= I->End. If End < I->Start or I == E, then we need
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp
index 1c06ffce17e..fa8c9e2a5fe 100644
--- a/llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp
@@ -1826,7 +1826,7 @@ Value *ReassociatePass::OptimizeMul(BinaryOperator *I,
return V;
ValueEntry NewEntry = ValueEntry(getRank(V), V);
- Ops.insert(std::lower_bound(Ops.begin(), Ops.end(), NewEntry), NewEntry);
+ Ops.insert(llvm::lower_bound(Ops, NewEntry), NewEntry);
return nullptr;
}
OpenPOWER on IntegriCloud