[llvm] [LoopDist] Add some runtime checks for cross partition loads (PR #145623)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 6 06:35:55 PDT 2025
================
@@ -504,6 +504,12 @@ class InstPartitionContainer {
Value *Ptr = RtPtrCheck->Pointers[I].PointerValue;
auto Instructions =
LAI.getInstructionsForAccess(Ptr, RtPtrCheck->Pointers[I].IsWritePtr);
+ const MemoryDepChecker &DC = LAI.getDepChecker();
+ bool IsWritePtr = !RtPtrCheck->Pointers[I].IsWritePtr;
+ if (!DC.getOrderForAccess(Ptr, IsWritePtr).empty()) {
+ auto AltInstructions = LAI.getInstructionsForAccess(Ptr, IsWritePtr);
+ Instructions.append(AltInstructions.begin(), AltInstructions.end());
+ }
----------------
Meinersbur wrote:
```suggestion
auto Instructions = LAI.getInstructionsForAccess(Ptr, true);
auto ReadInstructions = LAI.getInstructionsForAccess(Ptr, false);
Instructions.append(ReadInstructions.begin(), ReadInstructions.end());
```
`getOrderForAccess().empty()` just returns whether `getInstructionsForAccess` will be empty. If that is the case, there isn't any additional overhead of calling `getInstructionsForAccess` directly.
https://github.com/llvm/llvm-project/pull/145623
More information about the llvm-commits
mailing list