}
void Scop::removeStmtNotInDomainMap() {
- auto ShouldDelete = [this](ScopStmt &Stmt) -> bool {
+ removeStmts([this](ScopStmt &Stmt) -> bool {
isl::set Domain = DomainMap.lookup(Stmt.getEntryBlock());
if (!Domain)
return true;
return Domain.is_empty();
- };
- removeStmts(ShouldDelete, false);
+ });
}
void Scop::simplifySCoP(bool AfterHoisting) {
- auto ShouldDelete = [AfterHoisting](ScopStmt &Stmt) -> bool {
- // Never delete statements that contain calls to debug functions.
- if (hasDebugCall(&Stmt))
- return false;
-
- bool RemoveStmt = Stmt.isEmpty();
-
- // Remove read only statements only after invariant load hoisting.
- if (!RemoveStmt && AfterHoisting) {
- bool OnlyRead = true;
- for (MemoryAccess *MA : Stmt) {
- if (MA->isRead())
- continue;
-
- OnlyRead = false;
- break;
- }
-
- RemoveStmt = OnlyRead;
- }
- return RemoveStmt;
- };
-
- removeStmts(ShouldDelete, AfterHoisting);
+ removeStmts(
+ [AfterHoisting](ScopStmt &Stmt) -> bool {
+ // Never delete statements that contain calls to debug functions.
+ if (hasDebugCall(&Stmt))
+ return false;
+
+ bool RemoveStmt = Stmt.isEmpty();
+
+ // Remove read only statements only after invariant load hoisting.
+ if (!RemoveStmt && AfterHoisting) {
+ bool OnlyRead = true;
+ for (MemoryAccess *MA : Stmt) {
+ if (MA->isRead())
+ continue;
+
+ OnlyRead = false;
+ break;
+ }
+
+ RemoveStmt = OnlyRead;
+ }
+ return RemoveStmt;
+ },
+ AfterHoisting);
}
InvariantEquivClassTy *Scop::lookupInvariantEquivClass(Value *Val) {
void removeEmptyDomainStmts() {
size_t NumStmtsBefore = S->getSize();
- auto ShouldDelete = [](ScopStmt &Stmt) -> bool {
+ S->removeStmts([](ScopStmt &Stmt) -> bool {
auto EffectiveDomain =
Stmt.getDomain().intersect_params(Stmt.getParent()->getContext());
return EffectiveDomain.is_empty();
- };
- S->removeStmts(ShouldDelete);
+ });
assert(NumStmtsBefore >= S->getSize());
EmptyDomainsRemoved = NumStmtsBefore - S->getSize();