[DependenceInfo] Use ScopArrayInfo to keep track of arrays [NFC]

When computing reduction dependences we first identify all ScopArrays which are
part of reductions and then only compute for these ScopArrays the more detailed
data dependences that allow us to identify reductions and optimize across them.
Instead of using the base pointer as identifier of a ScopArray, it is clearer
and more understandable to directly use the ScopArray as identifier. This change
implements such a switch.

This change removes unnecessary uses of MemoryAddress::getBaseAddr() in
preparation for https://reviews.llvm.org/D28518.

llvm-svn: 294567
This commit is contained in:
Tobias Grosser 2017-02-09 08:06:05 +00:00
parent 02400a0e0c
commit 114f6d6ff5

View File

@ -123,12 +123,12 @@ static void collectInfo(Scop &S, isl_union_map **Read, isl_union_map **Write,
*AccessSchedule = isl_union_map_empty(isl_space_copy(Space));
*StmtSchedule = isl_union_map_empty(Space);
SmallPtrSet<const Value *, 8> ReductionBaseValues;
SmallPtrSet<const ScopArrayInfo *, 8> ReductionArrays;
if (UseReductions)
for (ScopStmt &Stmt : S)
for (MemoryAccess *MA : Stmt)
if (MA->isReductionLike())
ReductionBaseValues.insert(MA->getBaseAddr());
ReductionArrays.insert(MA->getScopArrayInfo());
for (ScopStmt &Stmt : S) {
for (MemoryAccess *MA : Stmt) {
@ -137,7 +137,7 @@ static void collectInfo(Scop &S, isl_union_map **Read, isl_union_map **Write,
accdom = isl_map_intersect_domain(accdom, domcp);
if (ReductionBaseValues.count(MA->getBaseAddr())) {
if (ReductionArrays.count(MA->getScopArrayInfo())) {
// Wrap the access domain and adjust the schedule accordingly.
//
// An access domain like
@ -178,7 +178,7 @@ static void collectInfo(Scop &S, isl_union_map **Read, isl_union_map **Write,
*Write = isl_union_map_add_map(*Write, accdom);
}
if (!ReductionBaseValues.empty() && Level == Dependences::AL_Statement)
if (!ReductionArrays.empty() && Level == Dependences::AL_Statement)
*StmtSchedule = isl_union_map_add_map(*StmtSchedule, Stmt.getSchedule());
}