[llvm-commits] [polly] r144643 - /polly/trunk/lib/Exchange/ScopLib.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Tue Nov 15 03:39:03 PST 2011
Author: grosser
Date: Tue Nov 15 05:39:02 2011
New Revision: 144643
URL: http://llvm.org/viewvc/llvm-project?rev=144643&view=rev
Log:
ScopLib: Fix export/import after parameters are now tagged with isl_ids.
Modified:
polly/trunk/lib/Exchange/ScopLib.cpp
Modified: polly/trunk/lib/Exchange/ScopLib.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/ScopLib.cpp?rev=144643&r1=144642&r2=144643&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/ScopLib.cpp (original)
+++ polly/trunk/lib/Exchange/ScopLib.cpp Tue Nov 15 05:39:02 2011
@@ -641,6 +641,20 @@
isl_ctx *ctx = PollyStmt->getParent()->getIslCtx();
isl_space *Space = isl_dim_alloc(ctx, NbParam, NbIterators, NbScattering);
+
+ isl_space *ParamSpace = PollyStmt->getParent()->getParamSpace();
+
+ // We need to copy the isl_ids for the parameter dimensions to the new
+ // map. Without doing this the current map would have different
+ // ids then the new one, even though both are named identically.
+ for (unsigned i = 0; i < isl_space_dim(Space, isl_dim_param);
+ i++) {
+ isl_id *id = isl_space_get_dim_id(ParamSpace, isl_dim_param, i);
+ Space = isl_space_set_dim_id(Space, isl_dim_param, i, id);
+ }
+
+ isl_space_free(ParamSpace);
+
Space = isl_space_set_tuple_name(Space, isl_dim_out, "scattering");
Space = isl_space_set_tuple_name(Space, isl_dim_in, PollyStmt->getBaseName());
@@ -663,6 +677,14 @@
typedef Dependences::StatementToIslMapTy StatementToIslMapTy;
+void freeStmtToIslMap(StatementToIslMapTy *Map) {
+ for (StatementToIslMapTy::iterator MI = Map->begin(), ME = Map->end();
+ MI != ME; ++MI)
+ isl_map_free(MI->second);
+
+ delete (Map);
+}
+
/// @brief Read the new scattering from the scoplib description.
///
/// @S The Scop to update
@@ -690,7 +712,7 @@
if (!stmt) {
errs() << "Not enough statements available in OpenScop file\n";
- delete &NewScattering;
+ freeStmtToIslMap(&NewScattering);
return NULL;
}
@@ -701,7 +723,7 @@
if (stmt) {
errs() << "Too many statements in OpenScop file\n";
- delete &NewScattering;
+ freeStmtToIslMap(&NewScattering);
return NULL;
}
@@ -720,6 +742,7 @@
return false;
if (!D->isValidScattering(NewScattering)) {
+ freeStmtToIslMap(NewScattering);
errs() << "OpenScop file contains a scattering that changes the "
<< "dependences. Use -disable-polly-legality to continue anyways\n";
return false;
@@ -730,9 +753,10 @@
ScopStmt *Stmt = *SI;
if (NewScattering->find(Stmt) != NewScattering->end())
- Stmt->setScattering((*NewScattering)[Stmt]);
+ Stmt->setScattering(isl_map_copy((*NewScattering)[Stmt]));
}
+ freeStmtToIslMap(NewScattering);
return true;
}
}
More information about the llvm-commits
mailing list