Skip to content

Commit 6538fff

Browse files
committed
[Polly] Inline ShoulDelete lambda. NFC.
As suggested by David Blaikie at ihttps://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20200824/822584.html
1 parent c971b53 commit 6538fff

File tree

2 files changed

+28
-30
lines changed

2 files changed

+28
-30
lines changed

polly/lib/Analysis/ScopInfo.cpp

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,40 +1773,39 @@ void Scop::removeStmts(function_ref<bool(ScopStmt &)> ShouldDelete,
17731773
}
17741774

17751775
void Scop::removeStmtNotInDomainMap() {
1776-
auto ShouldDelete = [this](ScopStmt &Stmt) -> bool {
1776+
removeStmts([this](ScopStmt &Stmt) -> bool {
17771777
isl::set Domain = DomainMap.lookup(Stmt.getEntryBlock());
17781778
if (!Domain)
17791779
return true;
17801780
return Domain.is_empty();
1781-
};
1782-
removeStmts(ShouldDelete, false);
1781+
});
17831782
}
17841783

17851784
void Scop::simplifySCoP(bool AfterHoisting) {
1786-
auto ShouldDelete = [AfterHoisting](ScopStmt &Stmt) -> bool {
1787-
// Never delete statements that contain calls to debug functions.
1788-
if (hasDebugCall(&Stmt))
1789-
return false;
1790-
1791-
bool RemoveStmt = Stmt.isEmpty();
1792-
1793-
// Remove read only statements only after invariant load hoisting.
1794-
if (!RemoveStmt && AfterHoisting) {
1795-
bool OnlyRead = true;
1796-
for (MemoryAccess *MA : Stmt) {
1797-
if (MA->isRead())
1798-
continue;
1799-
1800-
OnlyRead = false;
1801-
break;
1802-
}
1803-
1804-
RemoveStmt = OnlyRead;
1805-
}
1806-
return RemoveStmt;
1807-
};
1808-
1809-
removeStmts(ShouldDelete, AfterHoisting);
1785+
removeStmts(
1786+
[AfterHoisting](ScopStmt &Stmt) -> bool {
1787+
// Never delete statements that contain calls to debug functions.
1788+
if (hasDebugCall(&Stmt))
1789+
return false;
1790+
1791+
bool RemoveStmt = Stmt.isEmpty();
1792+
1793+
// Remove read only statements only after invariant load hoisting.
1794+
if (!RemoveStmt && AfterHoisting) {
1795+
bool OnlyRead = true;
1796+
for (MemoryAccess *MA : Stmt) {
1797+
if (MA->isRead())
1798+
continue;
1799+
1800+
OnlyRead = false;
1801+
break;
1802+
}
1803+
1804+
RemoveStmt = OnlyRead;
1805+
}
1806+
return RemoveStmt;
1807+
},
1808+
AfterHoisting);
18101809
}
18111810

18121811
InvariantEquivClassTy *Scop::lookupInvariantEquivClass(Value *Val) {

polly/lib/Transform/Simplify.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,11 @@ class Simplify : public ScopPass {
169169
void removeEmptyDomainStmts() {
170170
size_t NumStmtsBefore = S->getSize();
171171

172-
auto ShouldDelete = [](ScopStmt &Stmt) -> bool {
172+
S->removeStmts([](ScopStmt &Stmt) -> bool {
173173
auto EffectiveDomain =
174174
Stmt.getDomain().intersect_params(Stmt.getParent()->getContext());
175175
return EffectiveDomain.is_empty();
176-
};
177-
S->removeStmts(ShouldDelete);
176+
});
178177

179178
assert(NumStmtsBefore >= S->getSize());
180179
EmptyDomainsRemoved = NumStmtsBefore - S->getSize();

0 commit comments

Comments
 (0)