@@ -1781,14 +1781,14 @@ void MemoryDepChecker::mergeInStatus(VectorizationSafetyStatus S) {
17811781 Status = S;
17821782}
17831783
1784- // / Given a dependence-distance \p Dist between two
1785- // / memory accesses, that have strides in the same direction whose absolute
1786- // / value of the maximum stride is given in \p MaxStride, and that have the same
1787- // / type size \p TypeByteSize, in a loop whose maximum backedge taken count is
1788- // / \p MaxBTC, check if it is possible to prove statically that the dependence
1784+ // / Given a dependence-distance \p Dist between two memory accesses, that have
1785+ // / strides in the same direction whose absolute value of the maximum stride is
1786+ // / given in \p MaxStride, in a loop whose maximum backedge taken count is \p
1787+ // / MaxBTC, check if it is possible to prove statically that the dependence
17891788// / distance is larger than the range that the accesses will travel through the
17901789// / execution of the loop. If so, return true; false otherwise. This is useful
17911790// / for example in loops such as the following (PR31098):
1791+ // /
17921792// / for (i = 0; i < D; ++i) {
17931793// / = out[i];
17941794// / out[i+D] =
@@ -1844,8 +1844,8 @@ static bool isSafeDependenceDistance(const DataLayout &DL, ScalarEvolution &SE,
18441844}
18451845
18461846// / Check the dependence for two accesses with the same stride \p Stride.
1847- // / \p Distance is the positive distance and \p TypeByteSize is type size in
1848- // / bytes.
1847+ // / \p Distance is the positive distance in bytes, and \p TypeByteSize is type
1848+ // / size in bytes.
18491849// /
18501850// / \returns true if they are independent.
18511851static bool areStridedAccessesIndependent (uint64_t Distance, uint64_t Stride,
@@ -1983,13 +1983,14 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize(
19831983 return MemoryDepChecker::Dependence::Unknown;
19841984 }
19851985
1986- TypeSize AStoreSz = DL.getTypeStoreSize (ATy),
1987- BStoreSz = DL.getTypeStoreSize (BTy);
1986+ TypeSize AStoreSz = DL.getTypeStoreSize (ATy);
1987+ TypeSize BStoreSz = DL.getTypeStoreSize (BTy);
19881988
19891989 // If store sizes are not the same, set TypeByteSize to zero, so we can check
1990- // it in the caller.
1991- uint64_t ASz = DL.getTypeAllocSize (ATy), BSz = DL.getTypeAllocSize (BTy),
1992- TypeByteSize = AStoreSz == BStoreSz ? BSz : 0 ;
1990+ // it in the caller isDependent.
1991+ uint64_t ASz = DL.getTypeAllocSize (ATy);
1992+ uint64_t BSz = DL.getTypeAllocSize (BTy);
1993+ uint64_t TypeByteSize = (AStoreSz == BStoreSz) ? BSz : 0 ;
19931994
19941995 uint64_t StrideAScaled = std::abs (StrideAPtrInt) * ASz;
19951996 uint64_t StrideBScaled = std::abs (StrideBPtrInt) * BSz;
@@ -2159,7 +2160,7 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
21592160 // B[i] = A[i] + 1;
21602161 // }
21612162 //
2162- // Two accesses in memory (stride is 2):
2163+ // Two accesses in memory (stride is 4 * 2):
21632164 // | A[0] | | A[2] | | A[4] | | A[6] | |
21642165 // | B[0] | | B[2] | | B[4] |
21652166 //
0 commit comments