Skip to content

Commit 422b67a

Browse files
[Analysis] Use range-based for loops (NFC)
1 parent 09e6f12 commit 422b67a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

llvm/lib/Analysis/MemoryDependenceAnalysis.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,16 +1292,16 @@ bool MemoryDependenceResults::getNonLocalPointerDepFromBB(
12921292
if (InsertRes.first->second != Pointer.getAddr()) {
12931293
// Make sure to clean up the Visited map before continuing on to
12941294
// PredTranslationFailure.
1295-
for (unsigned i = 0; i < NewBlocks.size(); i++)
1296-
Visited.erase(NewBlocks[i]);
1295+
for (auto *NewBlock : NewBlocks)
1296+
Visited.erase(NewBlock);
12971297
goto PredTranslationFailure;
12981298
}
12991299
}
13001300
if (NewBlocks.size() > WorklistEntries) {
13011301
// Make sure to clean up the Visited map before continuing on to
13021302
// PredTranslationFailure.
1303-
for (unsigned i = 0; i < NewBlocks.size(); i++)
1304-
Visited.erase(NewBlocks[i]);
1303+
for (auto *NewBlock : NewBlocks)
1304+
Visited.erase(NewBlock);
13051305
GotWorklistLimit = true;
13061306
goto PredTranslationFailure;
13071307
}
@@ -1359,8 +1359,8 @@ bool MemoryDependenceResults::getNonLocalPointerDepFromBB(
13591359

13601360
// Make sure to clean up the Visited map before continuing on to
13611361
// PredTranslationFailure.
1362-
for (unsigned i = 0, n = PredList.size(); i < n; ++i)
1363-
Visited.erase(PredList[i].first);
1362+
for (const auto &Pred : PredList)
1363+
Visited.erase(Pred.first);
13641364

13651365
goto PredTranslationFailure;
13661366
}
@@ -1371,9 +1371,9 @@ bool MemoryDependenceResults::getNonLocalPointerDepFromBB(
13711371
// any results for. (getNonLocalPointerDepFromBB will modify our
13721372
// datastructures in ways the code after the PredTranslationFailure label
13731373
// doesn't expect.)
1374-
for (unsigned i = 0, n = PredList.size(); i < n; ++i) {
1375-
BasicBlock *Pred = PredList[i].first;
1376-
PHITransAddr &PredPointer = PredList[i].second;
1374+
for (auto &I : PredList) {
1375+
BasicBlock *Pred = I.first;
1376+
PHITransAddr &PredPointer = I.second;
13771377
Value *PredPtrVal = PredPointer.getAddr();
13781378

13791379
bool CanTranslate = true;

0 commit comments

Comments
 (0)