[polly] r211980 - Remove redundant code and use C++ range fors
Tobias Grosser
tobias at grosser.es
Sat Jun 28 01:59:38 PDT 2014
Author: grosser
Date: Sat Jun 28 03:59:38 2014
New Revision: 211980
URL: http://llvm.org/viewvc/llvm-project?rev=211980&view=rev
Log:
Remove redundant code and use C++ range fors
Modified:
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/CodeGen/IslAst.cpp
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=211980&r1=211979&r2=211980&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sat Jun 28 03:59:38 2014
@@ -1098,14 +1098,10 @@ void Scop::dump() const { print(dbgs());
isl_ctx *Scop::getIslCtx() const { return IslCtx; }
__isl_give isl_union_set *Scop::getDomains() {
- isl_union_set *Domain = nullptr;
+ isl_union_set *Domain = isl_union_set_empty(getParamSpace());
- for (Scop::iterator SI = begin(), SE = end(); SI != SE; ++SI)
- if (!Domain)
- Domain = isl_union_set_from_set((*SI)->getDomain());
- else
- Domain = isl_union_set_union(Domain,
- isl_union_set_from_set((*SI)->getDomain()));
+ for (ScopStmt *Stmt : *this)
+ Domain = isl_union_set_add_set(Domain, Stmt->getDomain());
return Domain;
}
@@ -1113,16 +1109,13 @@ __isl_give isl_union_set *Scop::getDomai
__isl_give isl_union_map *Scop::getWrites() {
isl_union_map *Write = isl_union_map_empty(this->getParamSpace());
- for (Scop::iterator SI = this->begin(), SE = this->end(); SI != SE; ++SI) {
- ScopStmt *Stmt = *SI;
-
+ for (ScopStmt *Stmt : *this) {
for (MemoryAccess *MA : *Stmt) {
if (!MA->isWrite())
continue;
isl_set *Domain = Stmt->getDomain();
isl_map *AccessDomain = MA->getAccessRelation();
-
AccessDomain = isl_map_intersect_domain(AccessDomain, Domain);
Write = isl_union_map_add_map(Write, AccessDomain);
}
@@ -1131,11 +1124,9 @@ __isl_give isl_union_map *Scop::getWrite
}
__isl_give isl_union_map *Scop::getReads() {
- isl_union_map *Read = isl_union_map_empty(this->getParamSpace());
-
- for (Scop::iterator SI = this->begin(), SE = this->end(); SI != SE; ++SI) {
- ScopStmt *Stmt = *SI;
+ isl_union_map *Read = isl_union_map_empty(getParamSpace());
+ for (ScopStmt *Stmt : *this) {
for (MemoryAccess *MA : *Stmt) {
if (!MA->isRead())
continue;
@@ -1151,21 +1142,18 @@ __isl_give isl_union_map *Scop::getReads
}
__isl_give isl_union_map *Scop::getSchedule() {
- isl_union_map *Schedule = isl_union_map_empty(this->getParamSpace());
+ isl_union_map *Schedule = isl_union_map_empty(getParamSpace());
- for (Scop::iterator SI = this->begin(), SE = this->end(); SI != SE; ++SI) {
- ScopStmt *Stmt = *SI;
+ for (ScopStmt *Stmt : *this)
Schedule = isl_union_map_add_map(Schedule, Stmt->getScattering());
- }
+
return isl_union_map_coalesce(Schedule);
}
bool Scop::restrictDomains(__isl_take isl_union_set *Domain) {
bool Changed = false;
- for (Scop::iterator SI = this->begin(), SE = this->end(); SI != SE; ++SI) {
- ScopStmt *Stmt = *SI;
+ for (ScopStmt *Stmt : *this) {
isl_union_set *StmtDomain = isl_union_set_from_set(Stmt->getDomain());
-
isl_union_set *NewStmtDomain = isl_union_set_intersect(
isl_union_set_copy(StmtDomain), isl_union_set_copy(Domain));
Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=211980&r1=211979&r2=211980&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Sat Jun 28 03:59:38 2014
@@ -69,7 +69,6 @@ private:
isl_ast_node *Root;
isl_ast_expr *RunCondition;
- __isl_give isl_union_map *getSchedule();
void buildRunCondition(__isl_keep isl_ast_build *Context);
};
} // End namespace polly.
@@ -366,7 +365,8 @@ IslAst::IslAst(Scop *Scop, Dependences &
Context = isl_ast_build_set_at_each_domain(Context, AtEachDomain, nullptr);
- isl_union_map *Schedule = getSchedule();
+ isl_union_map *Schedule =
+ isl_union_map_intersect_domain(S->getSchedule(), S->getDomains());
Function *F = Scop->getRegion().getEntry()->getParent();
(void)F;
@@ -395,20 +395,6 @@ IslAst::IslAst(Scop *Scop, Dependences &
DEBUG(pprint(dbgs()));
}
-__isl_give isl_union_map *IslAst::getSchedule() {
- isl_union_map *Schedule = isl_union_map_empty(S->getParamSpace());
-
- for (ScopStmt *Stmt : *S) {
- isl_map *StmtSchedule = Stmt->getScattering();
-
- StmtSchedule = isl_map_intersect_domain(StmtSchedule, Stmt->getDomain());
- Schedule =
- isl_union_map_union(Schedule, isl_union_map_from_map(StmtSchedule));
- }
-
- return Schedule;
-}
-
IslAst::~IslAst() {
isl_ast_node_free(Root);
isl_ast_expr_free(RunCondition);
More information about the llvm-commits
mailing list