Skip to content

Commit

Permalink
LAA: simplify LoopAccessInfoManager::clear (NFC) (#125488)
Browse files Browse the repository at this point in the history
DenseMap::erase() doesn't invalidate the iterator.
  • Loading branch information
artagnon authored Feb 3, 2025
1 parent fe8b323 commit db43dd7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions llvm/lib/Analysis/LoopAccessAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3078,7 +3078,6 @@ const LoopAccessInfo &LoopAccessInfoManager::getInfo(Loop &L) {
return *It->second;
}
void LoopAccessInfoManager::clear() {
SmallVector<Loop *> ToRemove;
// Collect LoopAccessInfo entries that may keep references to IR outside the
// analyzed loop or SCEVs that may have been modified or invalidated. At the
// moment, that is loops requiring memory or SCEV runtime checks, as those cache
Expand All @@ -3087,11 +3086,8 @@ void LoopAccessInfoManager::clear() {
if (LAI->getRuntimePointerChecking()->getChecks().empty() &&
LAI->getPSE().getPredicate().isAlwaysTrue())
continue;
ToRemove.push_back(L);
}

for (Loop *L : ToRemove)
LoopAccessInfoMap.erase(L);
}
}

bool LoopAccessInfoManager::invalidate(
Expand Down

0 comments on commit db43dd7

Please sign in to comment.