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

Michael Berg via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 18 15:50:16 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())
----------------
mcberg2021 wrote:

I'm going to guess at what you mean.  The original code handles all the like type ptrs from store to store and load to load in all partitions, so I believe that is covered.  I could make this a bit more generic in that I could use RtPtrCheck->Pointers[I].IsWritePtr to flip what we are looking for, adding a store check to based on the opposite state.  That would cover loads with cross partition stores as well as stores with cross partition loads.  If other, please elaborate.

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


More information about the llvm-commits mailing list