[llvm] [LAA] Avoid duplicate runtime-check group members (PR #226829)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 00:27:08 PDT 2026
================
@@ -764,22 +764,24 @@ void RuntimePointerChecking::groupChecks(
}
SmallVector<RuntimeCheckingPtrGroup, 2> Groups;
+ SmallPtrSet<Value *, 2> SeenPointers;
// Because DepCands is constructed by visiting accesses in the order in
// which they appear in alias sets (which is deterministic) and the
// iteration order within an equivalence class member is only dependent on
// 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())
+ Value *Pointer = M.getPointer();
+ // A read-modify-write access appears in DepCands in both access modes.
+ if (!SeenPointers.insert(Pointer).second)
continue;
- for (unsigned Pointer : PointerI->second) {
+
+ for (unsigned PointerIndex : PointerToIndices.lookup(Pointer)) {
bool Merged = false;
+
----------------
artagnon wrote:
```suggestion
for (unsigned PointerIndex : PointerToIndices.lookup(Pointer)) {
bool Merged = false;
```
Would be good to avoid introducing unrelated whitespace changes?
https://github.com/llvm/llvm-project/pull/226829
More information about the llvm-commits
mailing list