[llvm-commits] [polly] r157246 - /polly/trunk/lib/ScheduleOptimizer.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Tue May 22 03:47:31 PDT 2012
Author: grosser
Date: Tue May 22 05:47:31 2012
New Revision: 157246
URL: http://llvm.org/viewvc/llvm-project?rev=157246&view=rev
Log:
ScheduleOptimizer: Simplify some code
We now use isl_map_equate, which makes the code a lot simpler.
Modified:
polly/trunk/lib/ScheduleOptimizer.cpp
Modified: polly/trunk/lib/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/ScheduleOptimizer.cpp?rev=157246&r1=157245&r2=157246&view=diff
==============================================================================
--- polly/trunk/lib/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/ScheduleOptimizer.cpp Tue May 22 05:47:31 2012
@@ -197,33 +197,21 @@
ScopStmt *Stmt = *SI;
unsigned OldDimensions = Stmt->getNumScattering();
isl_space *Space;
- isl_basic_map *ChangeScattering;
+ isl_map *Map, *New;
Space = isl_space_alloc(Stmt->getIslCtx(), 0, OldDimensions, NewDimensions);
- ChangeScattering = isl_basic_map_universe(isl_space_copy(Space));
- isl_local_space *LocalSpace = isl_local_space_from_space(Space);
+ Map = isl_map_universe(Space);
- for (unsigned i = 0; i < OldDimensions; i++) {
- isl_constraint *c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
- isl_constraint_set_coefficient_si(c, isl_dim_in, i, 1);
- isl_constraint_set_coefficient_si(c, isl_dim_out, i, -1);
- ChangeScattering = isl_basic_map_add_constraint(ChangeScattering, c);
- }
+ for (unsigned i = 0; i < OldDimensions; i++)
+ Map = isl_map_equate(Map, isl_dim_in, i, isl_dim_out, i);
- for (unsigned i = OldDimensions; i < NewDimensions; i++) {
- isl_constraint *c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
- isl_constraint_set_coefficient_si(c, isl_dim_out, i, 1);
- ChangeScattering = isl_basic_map_add_constraint(ChangeScattering, c);
- }
+ for (unsigned i = OldDimensions; i < NewDimensions; i++)
+ Map = isl_map_fix_si(Map, isl_dim_out, i, 0);
- isl_map *ChangeScatteringMap = isl_map_from_basic_map(ChangeScattering);
- ChangeScatteringMap = isl_map_align_params(ChangeScatteringMap,
- S.getParamSpace());
- isl_map *NewScattering = isl_map_apply_range(Stmt->getScattering(),
- ChangeScatteringMap);
- Stmt->setScattering(NewScattering);
- isl_local_space_free(LocalSpace);
+ Map = isl_map_align_params(Map, S.getParamSpace());
+ New = isl_map_apply_range(Stmt->getScattering(), Map);
+ Stmt->setScattering(New);
}
}
More information about the llvm-commits
mailing list