File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -863,7 +863,7 @@ class LoopAccessInfoManager {
863
863
864
864
const LoopAccessInfo &getInfo (Loop &L);
865
865
866
- void clear () { LoopAccessInfoMap. clear (); }
866
+ void clear ();
867
867
868
868
bool invalidate (Function &F, const PreservedAnalyses &PA,
869
869
FunctionAnalysisManager::Invalidator &Inv);
Original file line number Diff line number Diff line change @@ -3084,6 +3084,22 @@ const LoopAccessInfo &LoopAccessInfoManager::getInfo(Loop &L) {
3084
3084
3085
3085
return *It->second ;
3086
3086
}
3087
+ void LoopAccessInfoManager::clear () {
3088
+ SmallVector<Loop *> ToRemove;
3089
+ // Collect LoopAccessInfo entries that may keep references to IR outside the
3090
+ // analyzed loop or SCEVs that may have been modified or invalidated. At the
3091
+ // moment, that is loops requiring memory or SCEV runtime checks, as those cache
3092
+ // SCEVs, e.g. for pointer expressions.
3093
+ for (const auto &[L, LAI] : LoopAccessInfoMap) {
3094
+ if (LAI->getRuntimePointerChecking ()->getChecks ().empty () &&
3095
+ LAI->getPSE ().getPredicate ().isAlwaysTrue ())
3096
+ continue ;
3097
+ ToRemove.push_back (L);
3098
+ }
3099
+
3100
+ for (Loop *L : ToRemove)
3101
+ LoopAccessInfoMap.erase (L);
3102
+ }
3087
3103
3088
3104
bool LoopAccessInfoManager::invalidate (
3089
3105
Function &F, const PreservedAnalyses &PA,
You can’t perform that action at this time.
0 commit comments