[llvm] [LoopDist] Add some runtime checks for cross partition loads (PR #145623)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 2 05:35:18 PDT 2025


================
@@ -521,6 +521,21 @@ class InstPartitionContainer {
           Partition = -1;
       }
       assert(Partition != -2 && "Pointer not belonging to any partition");
+      // All the store context uses of our address were processed,
+      // Now make sure we don't have cross partition loads.
+      if (RtPtrCheck->Pointers[I].IsWritePtr) {
+        if (Ptr->hasOneUse() || Partition == -1)
+          continue;
+
+        for (User *U : Ptr->users())
----------------
Meinersbur wrote:

There are other instructions other than LoadInst that only read from memory, such as calls marked with `ModRefInfo::Ref`. I think this should use `LAI.getInstructionsForAccess(Ptr, false)` as the code above, best even integrated with the code above: If `RtPtrCheck->Pointers[I].IsWritePtr` is true, compare `LAI.getInstructionsForAccess(Ptr, false)` and `LAI.getInstructionsForAccess(Ptr, true)`

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


More information about the llvm-commits mailing list