[llvm] [LAA] Keep pointer checks on partial analysis (PR #139719)

John Brawn via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 05:36:18 PDT 2025


================
@@ -2978,12 +2988,15 @@ void LoopAccessInfo::print(raw_ostream &OS, unsigned Depth) const {
   PSE->print(OS, Depth);
 }
 
-const LoopAccessInfo &LoopAccessInfoManager::getInfo(Loop &L) {
+const LoopAccessInfo &LoopAccessInfoManager::getInfo(Loop &L,
+                                                     bool AllowPartial) {
   const auto &[It, Inserted] = LoopAccessInfoMap.try_emplace(&L);
 
-  if (Inserted)
-    It->second =
-        std::make_unique<LoopAccessInfo>(&L, &SE, TTI, TLI, &AA, &DT, &LI);
+  // We need to create the LoopAccessInfo if either we don't already have one,
+  // or if it was created with a different value of AllowPartial.
----------------
john-brawn-arm wrote:

If we consider test/Analysis/LoopAccessAnalysis/allow-partial.ll, then with this change if we compare the output of ``-passes='print<access-info>'`` and ``-passes='print<access-info><allow-partial>,print<access-info>'`` then the ``print<access-info>`` gives different output in the second as it re-uses the LoopAccessInfo from the previous pass.

Potentially we could see the same thing if we has a transform pass that has AllowPartial=true followed by print\<access-info\>, but the only transform that has AllowPartial=true is LoopVersioningLICM which constructs LoopAccessInfoManager itself instead of using the LoopAccessAnalysis pass, so the analysis results won't be re-used anyway.

https://github.com/llvm/llvm-project/pull/139719


More information about the llvm-commits mailing list