[PATCH] D108371: [LAA] Add Memory dependence remarks.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 1 06:08:20 PST 2022


sdesmalen accepted this revision.
sdesmalen added a comment.
This revision is now accepted and ready to land.

LGTM with the nits addressed.



================
Comment at: llvm/lib/Analysis/LoopAccessAnalysis.cpp:2139
+  auto Deps = getDepChecker().getDependences();
+  DebugLoc SourceLoc;
+
----------------
nit: can be removed if you address my comment below.


================
Comment at: llvm/lib/Analysis/LoopAccessAnalysis.cpp:2141-2149
+  if (!Deps)
+    return;
+  auto Found = std::find_if(
+      Deps->begin(), Deps->end(), [](const MemoryDepChecker::Dependence &D) {
+        return MemoryDepChecker::Dependence::isSafeForVectorization(D.Type) !=
+               MemoryDepChecker::VectorizationSafetyStatus::Safe;
+      });
----------------
nit:
  if (!Deps || 
      llvm::find_if(Deps, [](const MemoryDepChecker::Dependence &D) { .. }) == Deps->end())
    return;


================
Comment at: llvm/lib/Analysis/LoopAccessAnalysis.cpp:2183-2190
+  if (Instruction *I = Dep.getSource(*this)) {
+    SourceLoc = I->getDebugLoc();
+    if (auto *DD = dyn_cast_or_null<Instruction>(getPointerOperand(I)))
+      SourceLoc = DD->getDebugLoc();
   }
+  if (SourceLoc)
+    R << " Memory location is the same as accessed at "
----------------
nit: this is more concisely written as:

  if (Instruction *I = Dep.getSource(*this)) {
    DebugLoc SourceLoc = I->getDebugLoc();
    if (auto *DD = dyn_cast_or_null<Instruction>(getPointerOperand(I)))
      SourceLoc = DD->getDebugLoc();
    R << " Memory location is the same as accessed at "
      << ore::NV("Location", SourceLoc);
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108371/new/

https://reviews.llvm.org/D108371



More information about the llvm-commits mailing list