[llvm] [LAA] Avoid duplicate runtime-check group members (PR #226829)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 05:20:49 PDT 2026


================
@@ -771,15 +771,13 @@ void RuntimePointerChecking::groupChecks(
     // the order in which unions and insertions are performed on the
     // equivalence class, the iteration order is deterministic.
     for (auto M : DepCands.members(Access)) {
-      auto PointerI = PositionMap.find(M.getPointer());
-      // If we can't find the pointer in PositionMap that means we can't
-      // generate a memcheck for it.
-      if (PointerI == PositionMap.end())
-        continue;
-      for (unsigned Pointer : PointerI->second) {
+      Value *Pointer = M.getPointer();
+      for (unsigned PointerIndex : PointerToIndices.lookup(Pointer)) {
+        // A read-modify-write access appears in DepCands in both access modes.
+        if (!SeenIndices.insert(PointerIndex).second)
+          continue;
+
         bool Merged = false;
-        // Mark this pointer as seen.
-        Seen.insert(Pointer);
----------------
fhahn wrote:

If the suggestion above works, can we simply turn this into an assert?

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


More information about the llvm-commits mailing list