Skip to content

Commit

Permalink
Rangify for loops.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283074 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
yrnkrn committed Oct 2, 2016
1 parent 892bbf6 commit c36f800
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions lib/IR/LegacyPassManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,12 +534,11 @@ PMTopLevelManager::setLastUser(ArrayRef<Pass*> AnalysisPasses, Pass *P) {

// If AP is the last user of other passes then make P last user of
// such passes.
for (DenseMap<Pass *, Pass *>::iterator LUI = LastUser.begin(),
LUE = LastUser.end(); LUI != LUE; ++LUI) {
if (LUI->second == AP)
for (auto LU : LastUser) {
if (LU.second == AP)
// DenseMap iterator is not invalidated here because
// this is just updating existing entries.
LastUser[LUI->first] = P;
LastUser[LU.first] = P;
}
}
}
Expand Down Expand Up @@ -789,10 +788,9 @@ void PMTopLevelManager::initializeAllAnalysisInfo() {
for (PMDataManager *IPM : IndirectPassManagers)
IPM->initializeAnalysisInfo();

for (DenseMap<Pass *, Pass *>::iterator DMI = LastUser.begin(),
DME = LastUser.end(); DMI != DME; ++DMI) {
SmallPtrSet<Pass *, 8> &L = InversedLastUser[DMI->second];
L.insert(DMI->first);
for (auto LU : LastUser) {
SmallPtrSet<Pass *, 8> &L = InversedLastUser[LU.second];
L.insert(LU.first);
}
}

Expand Down Expand Up @@ -833,9 +831,7 @@ bool PMDataManager::preserveHigherLevelAnalysis(Pass *P) {
return true;

const AnalysisUsage::VectorType &PreservedSet = AnUsage->getPreservedSet();
for (SmallVectorImpl<Pass *>::iterator I = HigherLevelAnalysis.begin(),
E = HigherLevelAnalysis.end(); I != E; ++I) {
Pass *P1 = *I;
for (Pass *P1 : HigherLevelAnalysis) {
if (P1->getAsImmutablePass() == nullptr &&
!is_contained(PreservedSet, P1->getPassID()))
return false;
Expand All @@ -854,9 +850,7 @@ void PMDataManager::verifyPreservedAnalysis(Pass *P) {
const AnalysisUsage::VectorType &PreservedSet = AnUsage->getPreservedSet();

// Verify preserved analysis
for (AnalysisUsage::VectorType::const_iterator I = PreservedSet.begin(),
E = PreservedSet.end(); I != E; ++I) {
AnalysisID AID = *I;
for (AnalysisID AID : PreservedSet) {
if (Pass *AP = findAnalysisPass(AID, true)) {
TimeRegion PassTimer(getPassTimer(AP));
AP->verifyAnalysis();
Expand Down Expand Up @@ -929,9 +923,8 @@ void PMDataManager::removeDeadPasses(Pass *P, StringRef Msg,
dbgs() << " Free these instances\n";
}

for (SmallVectorImpl<Pass *>::iterator I = DeadPasses.begin(),
E = DeadPasses.end(); I != E; ++I)
freePass(*I, Msg, DBG_STR);
for (Pass *P : DeadPasses)
freePass(P, Msg, DBG_STR);
}

void PMDataManager::freePass(Pass *P, StringRef Msg,
Expand Down

0 comments on commit c36f800

Please sign in to comment.