From 5c5cab7a134902b8bd78211fa40c45755c6a3c0d Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Mon, 3 Feb 2025 11:42:09 +0000 Subject: [PATCH 1/2] LAA: use make_early_inc_range to simplify code (NFC) --- llvm/lib/Analysis/LoopAccessAnalysis.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index ac8a35fbc54fb..7e4358dc62b1e 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -3078,20 +3078,16 @@ 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 // SCEVs, e.g. for pointer expressions. - for (const auto &[L, LAI] : LoopAccessInfoMap) { + for (const auto &[L, LAI] : make_early_inc_range(LoopAccessInfoMap)) { if (LAI->getRuntimePointerChecking()->getChecks().empty() && LAI->getPSE().getPredicate().isAlwaysTrue()) continue; - ToRemove.push_back(L); - } - - for (Loop *L : ToRemove) LoopAccessInfoMap.erase(L); + } } bool LoopAccessInfoManager::invalidate( From 7960105a6f552abd239f721fa036ad5debfd21b4 Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Mon, 3 Feb 2025 13:08:55 +0000 Subject: [PATCH 2/2] LAA: strip make_early_inc_range --- llvm/lib/Analysis/LoopAccessAnalysis.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index 7e4358dc62b1e..3202ba81be78e 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -3082,7 +3082,7 @@ void LoopAccessInfoManager::clear() { // 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 // SCEVs, e.g. for pointer expressions. - for (const auto &[L, LAI] : make_early_inc_range(LoopAccessInfoMap)) { + for (const auto &[L, LAI] : LoopAccessInfoMap) { if (LAI->getRuntimePointerChecking()->getChecks().empty() && LAI->getPSE().getPredicate().isAlwaysTrue()) continue;