diff options
author | Vedant Kumar <vsk@apple.com> | 2018-05-16 23:20:42 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-05-16 23:20:42 +0000 |
commit | 5a0872c2b751fd339e10c1b9d29ed4a9e62a323d (patch) | |
tree | 60578e1838b47b5da4279a36a8c17be782946192 /llvm/lib/Transforms | |
parent | ae83159530f2657d35bc2543065e23256489d7ea (diff) | |
download | bcm5719-llvm-5a0872c2b751fd339e10c1b9d29ed4a9e62a323d.tar.gz bcm5719-llvm-5a0872c2b751fd339e10c1b9d29ed4a9e62a323d.zip |
[STLExtras] Add size() for ranges, and remove distance()
r332057 introduced distance() for ranges. Based on post-commit feedback,
this renames distance() to size(). The new size() is also only enabled
when the operation is O(1).
Differential Revision: https://reviews.llvm.org/D46976
llvm-svn: 332551
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/GVNHoist.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp index 6994d964a9e..c35f0fdf683 100644 --- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp +++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp @@ -578,7 +578,7 @@ private: // Returns true when the values are flowing out to each edge. bool valueAnticipable(CHIArgs C, TerminatorInst *TI) const { - if (TI->getNumSuccessors() > (unsigned)distance(C)) + if (TI->getNumSuccessors() > (unsigned)size(C)) return false; // Not enough args in this CHI. for (auto CHI : C) { diff --git a/llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp b/llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp index 72ab175deca..3464b759280 100644 --- a/llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp +++ b/llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp @@ -285,7 +285,8 @@ bool MergedLoadStoreMotion::mergeStores(BasicBlock *T) { return false; // No. More than 2 predecessors. // #Instructions in Succ1 for Compile Time Control - int Size1 = distance(Pred1->instructionsWithoutDebug()); + auto InstsNoDbg = Pred1->instructionsWithoutDebug(); + int Size1 = std::distance(InstsNoDbg.begin(), InstsNoDbg.end()); int NStores = 0; for (BasicBlock::reverse_iterator RBI = Pred0->rbegin(), RBE = Pred0->rend(); |