From 6227d5c690504c7ada5780c00a635b282c46e275 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 4 Jul 2013 01:31:24 +0000 Subject: Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185606 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/BranchProbabilityInfo.cpp | 22 +++++++++++----------- lib/Analysis/LazyValueInfo.cpp | 8 ++++---- lib/Analysis/ProfileEstimatorPass.cpp | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'lib/Analysis') diff --git a/lib/Analysis/BranchProbabilityInfo.cpp b/lib/Analysis/BranchProbabilityInfo.cpp index a6481cf..7cdf828 100644 --- a/lib/Analysis/BranchProbabilityInfo.cpp +++ b/lib/Analysis/BranchProbabilityInfo.cpp @@ -151,8 +151,8 @@ bool BranchProbabilityInfo::calcUnreachableHeuristics(BasicBlock *BB) { uint32_t UnreachableWeight = std::max(UR_TAKEN_WEIGHT / (unsigned)UnreachableEdges.size(), MIN_WEIGHT); - for (SmallVector::iterator I = UnreachableEdges.begin(), - E = UnreachableEdges.end(); + for (SmallVectorImpl::iterator I = UnreachableEdges.begin(), + E = UnreachableEdges.end(); I != E; ++I) setEdgeWeight(BB, *I, UnreachableWeight); @@ -161,8 +161,8 @@ bool BranchProbabilityInfo::calcUnreachableHeuristics(BasicBlock *BB) { uint32_t ReachableWeight = std::max(UR_NONTAKEN_WEIGHT / (unsigned)ReachableEdges.size(), NORMAL_WEIGHT); - for (SmallVector::iterator I = ReachableEdges.begin(), - E = ReachableEdges.end(); + for (SmallVectorImpl::iterator I = ReachableEdges.begin(), + E = ReachableEdges.end(); I != E; ++I) setEdgeWeight(BB, *I, ReachableWeight); @@ -251,8 +251,8 @@ bool BranchProbabilityInfo::calcColdCallHeuristics(BasicBlock *BB) { uint32_t ColdWeight = std::max(CC_TAKEN_WEIGHT / (unsigned) ColdEdges.size(), MIN_WEIGHT); - for (SmallVector::iterator I = ColdEdges.begin(), - E = ColdEdges.end(); + for (SmallVectorImpl::iterator I = ColdEdges.begin(), + E = ColdEdges.end(); I != E; ++I) setEdgeWeight(BB, *I, ColdWeight); @@ -260,8 +260,8 @@ bool BranchProbabilityInfo::calcColdCallHeuristics(BasicBlock *BB) { return true; uint32_t NormalWeight = std::max( CC_NONTAKEN_WEIGHT / (unsigned) NormalEdges.size(), NORMAL_WEIGHT); - for (SmallVector::iterator I = NormalEdges.begin(), - E = NormalEdges.end(); + for (SmallVectorImpl::iterator I = NormalEdges.begin(), + E = NormalEdges.end(); I != E; ++I) setEdgeWeight(BB, *I, NormalWeight); @@ -326,7 +326,7 @@ bool BranchProbabilityInfo::calcLoopBranchHeuristics(BasicBlock *BB) { if (backWeight < NORMAL_WEIGHT) backWeight = NORMAL_WEIGHT; - for (SmallVector::iterator EI = BackEdges.begin(), + for (SmallVectorImpl::iterator EI = BackEdges.begin(), EE = BackEdges.end(); EI != EE; ++EI) { setEdgeWeight(BB, *EI, backWeight); } @@ -337,7 +337,7 @@ bool BranchProbabilityInfo::calcLoopBranchHeuristics(BasicBlock *BB) { if (inWeight < NORMAL_WEIGHT) inWeight = NORMAL_WEIGHT; - for (SmallVector::iterator EI = InEdges.begin(), + for (SmallVectorImpl::iterator EI = InEdges.begin(), EE = InEdges.end(); EI != EE; ++EI) { setEdgeWeight(BB, *EI, inWeight); } @@ -348,7 +348,7 @@ bool BranchProbabilityInfo::calcLoopBranchHeuristics(BasicBlock *BB) { if (exitWeight < MIN_WEIGHT) exitWeight = MIN_WEIGHT; - for (SmallVector::iterator EI = ExitingEdges.begin(), + for (SmallVectorImpl::iterator EI = ExitingEdges.begin(), EE = ExitingEdges.end(); EI != EE; ++EI) { setEdgeWeight(BB, *EI, exitWeight); } diff --git a/lib/Analysis/LazyValueInfo.cpp b/lib/Analysis/LazyValueInfo.cpp index 66b5e85..b6970af 100644 --- a/lib/Analysis/LazyValueInfo.cpp +++ b/lib/Analysis/LazyValueInfo.cpp @@ -421,8 +421,8 @@ void LVIValueHandle::deleted() { if (I->second == getValPtr()) ToErase.push_back(*I); } - - for (SmallVector::iterator I = ToErase.begin(), + + for (SmallVectorImpl::iterator I = ToErase.begin(), E = ToErase.end(); I != E; ++I) Parent->OverDefinedCache.erase(*I); @@ -444,8 +444,8 @@ void LazyValueInfoCache::eraseBlock(BasicBlock *BB) { if (I->first == BB) ToErase.push_back(*I); } - - for (SmallVector::iterator I = ToErase.begin(), + + for (SmallVectorImpl::iterator I = ToErase.begin(), E = ToErase.end(); I != E; ++I) OverDefinedCache.erase(*I); diff --git a/lib/Analysis/ProfileEstimatorPass.cpp b/lib/Analysis/ProfileEstimatorPass.cpp index b284b99..365b64c 100644 --- a/lib/Analysis/ProfileEstimatorPass.cpp +++ b/lib/Analysis/ProfileEstimatorPass.cpp @@ -181,7 +181,7 @@ void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) { double incoming = BBWeight; // Subtract the flow leaving the loop. std::set ProcessedExits; - for (SmallVector::iterator ei = ExitEdges.begin(), + for (SmallVectorImpl::iterator ei = ExitEdges.begin(), ee = ExitEdges.end(); ei != ee; ++ei) { if (ProcessedExits.insert(*ei).second) { double w = getEdgeWeight(*ei); @@ -216,7 +216,7 @@ void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) { // be distributed is split and the rounded, the last edge gets a somewhat // bigger value, but we are close enough for an estimation. double fraction = floor(incoming/Edges.size()); - for (SmallVector::iterator ei = Edges.begin(), ee = Edges.end(); + for (SmallVectorImpl::iterator ei = Edges.begin(), ee = Edges.end(); ei != ee; ++ei) { double w = 0; if (ei != (ee-1)) { @@ -289,7 +289,7 @@ void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) { double fraction = Edges.size() ? floor(BBWeight/Edges.size()) : 0.0; // Finally we know what flow is still not leaving the block, distribute this // flow onto the empty edges. - for (SmallVector::iterator ei = Edges.begin(), ee = Edges.end(); + for (SmallVectorImpl::iterator ei = Edges.begin(), ee = Edges.end(); ei != ee; ++ei) { if (ei != (ee-1)) { EdgeInformation[BB->getParent()][*ei] += fraction; -- cgit v1.1