Store the size of the outermost dimension in case of newly created arrays that require memory allocation.
We do not need the size of the outermost dimension in most cases, but if we
allocate memory for newly created arrays, that size is needed.
Reviewed-by: Michael Kruse <llvm@meinersbur.de>
Differential Revision: https://reviews.llvm.org/D23991
llvm-svn: 281234
diff --git a/polly/lib/Transform/ScheduleOptimizer.cpp b/polly/lib/Transform/ScheduleOptimizer.cpp
index c825892..b89374d 100644
--- a/polly/lib/Transform/ScheduleOptimizer.cpp
+++ b/polly/lib/Transform/ScheduleOptimizer.cpp
@@ -717,7 +717,7 @@
/// the matrix multiplication pattern.
///
/// Create an access relation of the following form:
-/// [O0, O1, O2, O3, O4, O5, O6, O7, O8] -> [0, O5 + K * OI, OJ],
+/// [O0, O1, O2, O3, O4, O5, O6, O7, O8] -> [O5 + K * OI, OJ],
/// where K is @p Coeff, I is @p FirstDim, J is @p SecondDim.
///
/// It can be used, for example, to create relations that helps to consequently
@@ -745,17 +745,16 @@
unsigned Coeff, unsigned FirstDim,
unsigned SecondDim) {
auto *Ctx = isl_map_get_ctx(MapOldIndVar);
- auto *AccessRelSpace = isl_space_alloc(Ctx, 0, 9, 3);
+ auto *AccessRelSpace = isl_space_alloc(Ctx, 0, 9, 2);
auto *AccessRel = isl_map_universe(isl_space_copy(AccessRelSpace));
auto *ConstrSpace = isl_local_space_from_space(AccessRelSpace);
auto *Constr = isl_constraint_alloc_equality(ConstrSpace);
- Constr = isl_constraint_set_coefficient_si(Constr, isl_dim_out, 1, -1);
+ Constr = isl_constraint_set_coefficient_si(Constr, isl_dim_out, 0, -1);
Constr = isl_constraint_set_coefficient_si(Constr, isl_dim_in, 5, 1);
Constr =
isl_constraint_set_coefficient_si(Constr, isl_dim_in, FirstDim, Coeff);
AccessRel = isl_map_add_constraint(AccessRel, Constr);
- AccessRel = isl_map_fix_si(AccessRel, isl_dim_out, 0, 0);
- AccessRel = isl_map_equate(AccessRel, isl_dim_in, SecondDim, isl_dim_out, 2);
+ AccessRel = isl_map_equate(AccessRel, isl_dim_in, SecondDim, isl_dim_out, 1);
return isl_map_apply_range(MapOldIndVar, AccessRel);
}