[llvm] [LAA] Prepare to handle diff type sizes (NFC) (PR #122318)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 17 01:23:28 PDT 2025
================
@@ -1949,17 +1949,21 @@ static bool isSafeDependenceDistance(const DataLayout &DL, ScalarEvolution &SE,
/// Check the dependence for two accesses with the same stride \p Stride.
/// \p Distance is the positive distance in bytes, and \p TypeByteSize is type
-/// size in bytes.
+/// size of source and sink in bytes.
+/// TODO: Relax HasSameSize check in caller.
///
/// \returns true if they are independent.
-static bool areStridedAccessesIndependent(uint64_t Distance, uint64_t Stride,
- uint64_t TypeByteSize) {
+static bool
+areStridedAccessesIndependent(uint64_t Distance, uint64_t Stride,
+ std::pair<uint64_t, uint64_t> TypeByteSize) {
assert(Stride > 1 && "The stride must be greater than 1");
- assert(TypeByteSize > 0 && "The type size in byte must be non-zero");
+ assert(TypeByteSize.first > 0 && TypeByteSize.second > 0 &&
+ "The type size in byte must be non-zero");
assert(Distance > 0 && "The distance must be non-zero");
- // Skip if the distance is not multiple of type byte size.
- if (Distance % TypeByteSize)
+ // Skip if the distance is not multiple of type byte size of either source or
+ // sink.
+ if (Distance % TypeByteSize.first || Distance % TypeByteSize.second)
----------------
fhahn wrote:
For now better to keep the original code in the NFC patch to keep the unrelated changes out of the diff?
https://github.com/llvm/llvm-project/pull/122318
More information about the llvm-commits
mailing list