[polly] r237934 - Replace low-level constraint building with higher level functions
Tobias Grosser
tobias at grosser.es
Thu May 21 12:02:44 PDT 2015
Author: grosser
Date: Thu May 21 14:02:44 2015
New Revision: 237934
URL: http://llvm.org/viewvc/llvm-project?rev=237934&view=rev
Log:
Replace low-level constraint building with higher level functions
Instead of explicitly building constraints and adding them to our maps we
now use functions like map_order_le to add the relevant information to the
maps.
Modified:
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/Transform/ScheduleOptimizer.cpp
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=237934&r1=237933&r2=237934&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Thu May 21 14:02:44 2015
@@ -747,8 +747,7 @@ void MemoryAccess::dump() const { print(
//
static isl_map *getEqualAndLarger(isl_space *setDomain) {
isl_space *Space = isl_space_map_from_set(setDomain);
- isl_map *Map = isl_map_universe(isl_space_copy(Space));
- isl_local_space *MapLocalSpace = isl_local_space_from_space(Space);
+ isl_map *Map = isl_map_universe(Space);
unsigned lastDimension = isl_map_dim(Map, isl_dim_in) - 1;
// Set all but the last dimension to be equal for the input and output
@@ -762,20 +761,8 @@ static isl_map *getEqualAndLarger(isl_sp
// last dimension of the output.
//
// input[?,?,?,...,iX] -> output[?,?,?,...,oX] : iX < oX
- //
- isl_val *v;
- isl_ctx *Ctx = isl_map_get_ctx(Map);
- isl_constraint *c = isl_inequality_alloc(isl_local_space_copy(MapLocalSpace));
- v = isl_val_int_from_si(Ctx, -1);
- c = isl_constraint_set_coefficient_val(c, isl_dim_in, lastDimension, v);
- v = isl_val_int_from_si(Ctx, 1);
- c = isl_constraint_set_coefficient_val(c, isl_dim_out, lastDimension, v);
- v = isl_val_int_from_si(Ctx, -1);
- c = isl_constraint_set_constant_val(c, v);
-
- Map = isl_map_add_constraint(Map, c);
-
- isl_local_space_free(MapLocalSpace);
+ Map = isl_map_order_lt(Map, isl_dim_in, lastDimension, isl_dim_out,
+ lastDimension);
return Map;
}
Modified: polly/trunk/lib/Transform/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ScheduleOptimizer.cpp?rev=237934&r1=237933&r2=237934&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/Transform/ScheduleOptimizer.cpp Thu May 21 14:02:44 2015
@@ -213,17 +213,12 @@ IslScheduleOptimizer::getPrevectorMap(is
// Create an identity map for everything except DimToVectorize and map
// DimToVectorize to the point loop at the innermost dimension.
- for (int i = 0; i < ScheduleDimensions; i++) {
- c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
- c = isl_constraint_set_coefficient_si(c, isl_dim_in, i, -1);
-
+ for (int i = 0; i < ScheduleDimensions; i++)
if (i == DimToVectorize)
- c = isl_constraint_set_coefficient_si(c, isl_dim_out, PointDimension, 1);
+ TilingMap =
+ isl_map_equate(TilingMap, isl_dim_in, i, isl_dim_out, PointDimension);
else
- c = isl_constraint_set_coefficient_si(c, isl_dim_out, i, 1);
-
- TilingMap = isl_map_add_constraint(TilingMap, c);
- }
+ TilingMap = isl_map_equate(TilingMap, isl_dim_in, i, isl_dim_out, i);
// it % 'VectorWidth' = 0
LocalSpaceRange = isl_local_space_range(isl_local_space_copy(LocalSpace));
@@ -236,10 +231,8 @@ IslScheduleOptimizer::getPrevectorMap(is
TilingMap = isl_map_intersect_range(TilingMap, Modulo);
// it <= ip
- c = isl_inequality_alloc(isl_local_space_copy(LocalSpace));
- isl_constraint_set_coefficient_si(c, isl_dim_out, TileDimension, -1);
- isl_constraint_set_coefficient_si(c, isl_dim_out, PointDimension, 1);
- TilingMap = isl_map_add_constraint(TilingMap, c);
+ TilingMap = isl_map_order_le(TilingMap, isl_dim_out, TileDimension,
+ isl_dim_out, PointDimension);
// ip <= it + ('VectorWidth' - 1)
c = isl_inequality_alloc(LocalSpace);
More information about the llvm-commits
mailing list