[llvm-commits] [polly] r131010 - in /polly/trunk: include/polly/ScopInfo.h lib/Analysis/Dependences.cpp lib/Analysis/ScopInfo.cpp lib/Cloog.cpp lib/Exchange/OpenScopExporter.cpp lib/Exchange/ScopLib.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Fri May 6 12:52:19 PDT 2011
Author: grosser
Date: Fri May 6 14:52:19 2011
New Revision: 131010
URL: http://llvm.org/viewvc/llvm-project?rev=131010&view=rev
Log:
ScopInfo: Do not return reference to member variable 'domain'.
Instead of returning a pointer to the domain, we return a new copy of it. This
is safer, as we do not give access to internal objects. It is also not
expensive, as isl will just increment a reference counter.
Modified:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/lib/Analysis/Dependences.cpp
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/Cloog.cpp
polly/trunk/lib/Exchange/OpenScopExporter.cpp
polly/trunk/lib/Exchange/ScopLib.cpp
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=131010&r1=131009&r2=131010&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Fri May 6 14:52:19 2011
@@ -278,7 +278,7 @@
/// @brief Get the iteration domain of this ScopStmt.
///
/// @return The iteration domain of this ScopStmt.
- isl_set *getDomain() const { return Domain; }
+ isl_set *getDomain() const;
/// @brief Get an isl string representing this domain.
std::string getDomainStr() const;
Modified: polly/trunk/lib/Analysis/Dependences.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/Dependences.cpp?rev=131010&r1=131009&r2=131010&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/Dependences.cpp (original)
+++ polly/trunk/lib/Analysis/Dependences.cpp Fri May 6 14:52:19 2011
@@ -96,7 +96,7 @@
for (ScopStmt::memacc_iterator MI = Stmt->memacc_begin(),
ME = Stmt->memacc_end(); MI != ME; ++MI) {
- isl_set *domcp = isl_set_copy(Stmt->getDomain());
+ isl_set *domcp = Stmt->getDomain();
isl_map *accdom = isl_map_copy((*MI)->getAccessFunction());
accdom = isl_map_intersect_domain(accdom, domcp);
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=131010&r1=131009&r2=131010&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri May 6 14:52:19 2011
@@ -650,7 +650,10 @@
}
std::string ScopStmt::getDomainStr() const {
- return stringFromIslObj(getDomain());
+ isl_set *domain = getDomain();
+ std::string string = stringFromIslObj(domain);
+ isl_set_free(domain);
+ return string;
}
std::string ScopStmt::getScatteringStr() const {
@@ -695,6 +698,10 @@
return Parent.getCtx();
}
+isl_set *ScopStmt::getDomain() const {
+ return isl_set_copy(Domain);
+}
+
ScopStmt::~ScopStmt() {
while (!MemAccs.empty()) {
delete MemAccs.back();
Modified: polly/trunk/lib/Cloog.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Cloog.cpp?rev=131010&r1=131009&r2=131010&view=diff
==============================================================================
--- polly/trunk/lib/Cloog.cpp (original)
+++ polly/trunk/lib/Cloog.cpp Fri May 6 14:52:19 2011
@@ -161,7 +161,7 @@
CloogScattering *Scattering=
cloog_scattering_from_isl_map(isl_map_copy(Stmt->getScattering()));
CloogDomain *Domain =
- cloog_domain_from_isl_set(isl_set_copy(Stmt->getDomain()));
+ cloog_domain_from_isl_set(Stmt->getDomain());
std::string entryName = Stmt->getBaseName();
char *Name = (char*)malloc(sizeof(char) * (entryName.size() + 1));
Modified: polly/trunk/lib/Exchange/OpenScopExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/OpenScopExporter.cpp?rev=131010&r1=131009&r2=131010&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/OpenScopExporter.cpp (original)
+++ polly/trunk/lib/Exchange/OpenScopExporter.cpp Fri May 6 14:52:19 2011
@@ -143,8 +143,10 @@
openscop_statement_p Stmt = openscop_statement_malloc();
// Domain & Schedule
- Stmt->domain = domainToMatrix(stmt->getDomain());
+ isl_set *domain = stmt->getDomain();
+ Stmt->domain = domainToMatrix(domain);
Stmt->schedule = scatteringToMatrix(stmt->getScattering());
+ isl_set_free(domain);
// Statement name
const char* entryName = stmt->getBaseName();
Modified: polly/trunk/lib/Exchange/ScopLib.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/ScopLib.cpp?rev=131010&r1=131009&r2=131010&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/ScopLib.cpp (original)
+++ polly/trunk/lib/Exchange/ScopLib.cpp Fri May 6 14:52:19 2011
@@ -88,10 +88,12 @@
scoplib_statement_p Stmt = scoplib_statement_malloc();
// Domain & Schedule
+ isl_set *domain = stmt->getDomain();
Stmt->domain = scoplib_matrix_list_malloc();
- Stmt->domain->elt = domainToMatrix(stmt->getDomain());
+ Stmt->domain->elt = domainToMatrix(domain);
Stmt->domain->next = NULL;
Stmt->schedule = scatteringToMatrix(stmt->getScattering());
+ isl_set_free(domain);
// Statement name
std::string entryName;
More information about the llvm-commits
mailing list