From db43dd7f4fb60641911ffd6364c33e1f83c44b7f Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Mon, 3 Feb 2025 16:06:21 +0000 Subject: [PATCH] LAA: simplify LoopAccessInfoManager::clear (NFC) (#125488) DenseMap::erase() doesn't invalidate the iterator. --- llvm/lib/Analysis/LoopAccessAnalysis.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index ac8a35fbc54fb..3202ba81be78e 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -3078,7 +3078,6 @@ const LoopAccessInfo &LoopAccessInfoManager::getInfo(Loop &L) { return *It->second; } void LoopAccessInfoManager::clear() { - SmallVector 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 @@ -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(