diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/LazyCallGraph.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/CodeGen/ImplicitNullChecks.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/IR/Value.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/GVNHoist.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp | 3 |
5 files changed, 10 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/LazyCallGraph.cpp b/llvm/lib/Analysis/LazyCallGraph.cpp index c001f55bb62..b1d585bfc68 100644 --- a/llvm/lib/Analysis/LazyCallGraph.cpp +++ b/llvm/lib/Analysis/LazyCallGraph.cpp @@ -1273,7 +1273,7 @@ LazyCallGraph::RefSCC::removeInternalRefEdge(Node &SourceN, // the removal hasn't changed the structure at all. This is an important // special case and we can directly exit the entire routine more // efficiently as soon as we discover it. - if (distance(RefSCCNodes) == NumRefSCCNodes) { + if (llvm::size(RefSCCNodes) == NumRefSCCNodes) { // Clear out the low link field as we won't need it. for (Node *N : RefSCCNodes) N->LowLink = -1; @@ -1739,7 +1739,7 @@ static void printNode(raw_ostream &OS, LazyCallGraph::Node &N) { } static void printSCC(raw_ostream &OS, LazyCallGraph::SCC &C) { - ptrdiff_t Size = distance(C); + ptrdiff_t Size = size(C); OS << " SCC with " << Size << " functions:\n"; for (LazyCallGraph::Node &N : C) @@ -1747,7 +1747,7 @@ static void printSCC(raw_ostream &OS, LazyCallGraph::SCC &C) { } static void printRefSCC(raw_ostream &OS, LazyCallGraph::RefSCC &C) { - ptrdiff_t Size = distance(C); + ptrdiff_t Size = size(C); OS << " RefSCC with " << Size << " call SCCs:\n"; for (LazyCallGraph::SCC &InnerC : C) diff --git a/llvm/lib/CodeGen/ImplicitNullChecks.cpp b/llvm/lib/CodeGen/ImplicitNullChecks.cpp index 285f746875e..98c3039863e 100644 --- a/llvm/lib/CodeGen/ImplicitNullChecks.cpp +++ b/llvm/lib/CodeGen/ImplicitNullChecks.cpp @@ -597,7 +597,7 @@ MachineInstr *ImplicitNullChecks::insertFaultingInstr( unsigned DefReg = NoRegister; if (NumDefs != 0) { DefReg = MI->defs().begin()->getReg(); - assert(distance(MI->defs()) == 1 && "expected exactly one def!"); + assert(NumDefs == 1 && "expected exactly one def!"); } FaultMaps::FaultKind FK; diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index bdcc657abe6..2f95e9348b4 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -167,7 +167,9 @@ bool Value::isUsedInBasicBlock(const BasicBlock *BB) const { return false; } -unsigned Value::getNumUses() const { return (unsigned)distance(uses()); } +unsigned Value::getNumUses() const { + return (unsigned)std::distance(use_begin(), use_end()); +} static bool getSymTab(Value *V, ValueSymbolTable *&ST) { ST = nullptr; 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(); |