diff options
author | Craig Topper <craig.topper@gmail.com> | 2013-07-04 01:31:24 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2013-07-04 01:31:24 +0000 |
commit | 6227d5c690504c7ada5780c00a635b282c46e275 (patch) | |
tree | b0e11b1821db02d0e9b86095ff0d67c627f915bd /lib/Analysis | |
parent | c589a5f2849620306b14077b16e51a3e0b7ef5cd (diff) | |
download | external_llvm-6227d5c690504c7ada5780c00a635b282c46e275.zip external_llvm-6227d5c690504c7ada5780c00a635b282c46e275.tar.gz external_llvm-6227d5c690504c7ada5780c00a635b282c46e275.tar.bz2 |
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
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/BranchProbabilityInfo.cpp | 22 | ||||
-rw-r--r-- | lib/Analysis/LazyValueInfo.cpp | 8 | ||||
-rw-r--r-- | lib/Analysis/ProfileEstimatorPass.cpp | 6 |
3 files changed, 18 insertions, 18 deletions
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<unsigned, 4>::iterator I = UnreachableEdges.begin(), - E = UnreachableEdges.end(); + for (SmallVectorImpl<unsigned>::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<unsigned, 4>::iterator I = ReachableEdges.begin(), - E = ReachableEdges.end(); + for (SmallVectorImpl<unsigned>::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<unsigned, 4>::iterator I = ColdEdges.begin(), - E = ColdEdges.end(); + for (SmallVectorImpl<unsigned>::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<unsigned, 4>::iterator I = NormalEdges.begin(), - E = NormalEdges.end(); + for (SmallVectorImpl<unsigned>::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<unsigned, 8>::iterator EI = BackEdges.begin(), + for (SmallVectorImpl<unsigned>::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<unsigned, 8>::iterator EI = InEdges.begin(), + for (SmallVectorImpl<unsigned>::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<unsigned, 8>::iterator EI = ExitingEdges.begin(), + for (SmallVectorImpl<unsigned>::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<OverDefinedPairTy, 4>::iterator I = ToErase.begin(), + + for (SmallVectorImpl<OverDefinedPairTy>::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<OverDefinedPairTy, 4>::iterator I = ToErase.begin(), + + for (SmallVectorImpl<OverDefinedPairTy>::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<Edge> ProcessedExits; - for (SmallVector<Edge, 8>::iterator ei = ExitEdges.begin(), + for (SmallVectorImpl<Edge>::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<Edge, 8>::iterator ei = Edges.begin(), ee = Edges.end(); + for (SmallVectorImpl<Edge>::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<Edge, 8>::iterator ei = Edges.begin(), ee = Edges.end(); + for (SmallVectorImpl<Edge>::iterator ei = Edges.begin(), ee = Edges.end(); ei != ee; ++ei) { if (ei != (ee-1)) { EdgeInformation[BB->getParent()][*ei] += fraction; |