Skip to content

Commit e92715a

Browse files
committed
[LAA] Address review
1 parent 2ccbf04 commit e92715a

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,21 +1949,17 @@ static bool isSafeDependenceDistance(const DataLayout &DL, ScalarEvolution &SE,
19491949

19501950
/// Check the dependence for two accesses with the same stride \p Stride.
19511951
/// \p Distance is the positive distance in bytes, and \p TypeByteSize is type
1952-
/// size of source and sink in bytes.
1953-
/// TODO: Relax HasSameSize check in caller.
1952+
/// size in bytes.
19541953
///
19551954
/// \returns true if they are independent.
1956-
static bool
1957-
areStridedAccessesIndependent(uint64_t Distance, uint64_t Stride,
1958-
std::pair<uint64_t, uint64_t> TypeByteSize) {
1955+
static bool areStridedAccessesIndependent(uint64_t Distance, uint64_t Stride,
1956+
uint64_t TypeByteSize) {
19591957
assert(Stride > 1 && "The stride must be greater than 1");
1960-
assert(TypeByteSize.first > 0 && TypeByteSize.second > 0 &&
1961-
"The type size in byte must be non-zero");
1958+
assert(TypeByteSize > 0 && "The type size in byte must be non-zero");
19621959
assert(Distance > 0 && "The distance must be non-zero");
19631960

1964-
// Skip if the distance is not multiple of type byte size of either source or
1965-
// sink.
1966-
if (Distance % TypeByteSize.first || Distance % TypeByteSize.second)
1961+
// Skip if the distance is not multiple of type byte size.
1962+
if (Distance % TypeByteSize)
19671963
return false;
19681964

19691965
// No dependence if the distance is not multiple of the stride.
@@ -2196,7 +2192,8 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
21962192
// If the distance between accesses and their strides are known constants,
21972193
// check whether the accesses interlace each other.
21982194
if (ConstDist > 0 && CommonStride && CommonStride > 1 && HasSameSize &&
2199-
areStridedAccessesIndependent(ConstDist, *CommonStride, TypeByteSize)) {
2195+
areStridedAccessesIndependent(ConstDist, *CommonStride,
2196+
TypeByteSize.first)) {
22002197
LLVM_DEBUG(dbgs() << "LAA: Strided accesses are independent\n");
22012198
return Dependence::NoDep;
22022199
}
@@ -2211,6 +2208,7 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
22112208
if (SE.isKnownNonPositive(Dist)) {
22122209
if (SE.isKnownNonNegative(Dist)) {
22132210
// Write to the same location with the same size.
2211+
assert(HasSameSize && "Accesses must have the same size");
22142212
return Dependence::Forward;
22152213
}
22162214

0 commit comments

Comments
 (0)