Skip to content

Commit db43dd7

Browse files
authored
LAA: simplify LoopAccessInfoManager::clear (NFC) (#125488)
DenseMap::erase() doesn't invalidate the iterator.
1 parent fe8b323 commit db43dd7

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3078,7 +3078,6 @@ const LoopAccessInfo &LoopAccessInfoManager::getInfo(Loop &L) {
30783078
return *It->second;
30793079
}
30803080
void LoopAccessInfoManager::clear() {
3081-
SmallVector<Loop *> ToRemove;
30823081
// Collect LoopAccessInfo entries that may keep references to IR outside the
30833082
// analyzed loop or SCEVs that may have been modified or invalidated. At the
30843083
// moment, that is loops requiring memory or SCEV runtime checks, as those cache
@@ -3087,11 +3086,8 @@ void LoopAccessInfoManager::clear() {
30873086
if (LAI->getRuntimePointerChecking()->getChecks().empty() &&
30883087
LAI->getPSE().getPredicate().isAlwaysTrue())
30893088
continue;
3090-
ToRemove.push_back(L);
3091-
}
3092-
3093-
for (Loop *L : ToRemove)
30943089
LoopAccessInfoMap.erase(L);
3090+
}
30953091
}
30963092

30973093
bool LoopAccessInfoManager::invalidate(

0 commit comments

Comments
 (0)