Check reduction dependencies in case of the matrix multiplication optimization
To determine parameters of the matrix multiplication, we check RAW dependencies
that can be expressed using only reduction dependencies. Consequently, we
should check the reduction dependencies, if this is the case.
Reviewed-by: Tobias Grosser <tobias@grosser.es>,
Sven Verdoolaege <skimo-polly@kotnet.org>
Michael Kruse <llvm@meinersbur.de>
Differential Revision: https://reviews.llvm.org/D29814
llvm-svn: 294836
diff --git a/polly/lib/Transform/ScheduleOptimizer.cpp b/polly/lib/Transform/ScheduleOptimizer.cpp
index 862e905..94b6e89 100644
--- a/polly/lib/Transform/ScheduleOptimizer.cpp
+++ b/polly/lib/Transform/ScheduleOptimizer.cpp
@@ -765,12 +765,15 @@
return false;
}
isl_union_map_free(WAR);
- auto *RAW = D->getDependences(Dependences::TYPE_RAW);
+ auto *Dep = D->getDependences(Dependences::TYPE_RAW);
+ auto *Red = D->getDependences(Dependences::TYPE_RED);
+ if (Red)
+ Dep = isl_union_map_union(Dep, Red);
auto *DomainSpace = isl_space_domain(isl_map_get_space(Schedule));
auto *Space = isl_space_map_from_domain_and_range(isl_space_copy(DomainSpace),
DomainSpace);
- auto *Deltas = isl_map_deltas(isl_union_map_extract_map(RAW, Space));
- isl_union_map_free(RAW);
+ auto *Deltas = isl_map_deltas(isl_union_map_extract_map(Dep, Space));
+ isl_union_map_free(Dep);
int DeltasDimNum = isl_set_dim(Deltas, isl_dim_set);
isl_set_free(Deltas);
for (int i = 0; i < DeltasDimNum; i++) {