aboutsummaryrefslogtreecommitdiff
path: root/polly
diff options
context:
space:
mode:
authorMichael Kruse <llvm-project@meinersbur.de>2020-08-26 13:11:41 -0500
committerMichael Kruse <llvm-project@meinersbur.de>2020-08-26 13:15:23 -0500
commit6538fff37245921a0983d94c08af7e6cc120b3a9 (patch)
tree51e4666a1fef685d9131ca227b22681f92b1abb5 /polly
parentc971b53b22a5cd43b54bf4773fe3c59ea1b805fb (diff)
downloadllvm-6538fff37245921a0983d94c08af7e6cc120b3a9.zip
llvm-6538fff37245921a0983d94c08af7e6cc120b3a9.tar.gz
llvm-6538fff37245921a0983d94c08af7e6cc120b3a9.tar.bz2
[Polly] Inline ShoulDelete lambda. NFC.
As suggested by David Blaikie at ihttps://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20200824/822584.html
Diffstat (limited to 'polly')
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp53
-rw-r--r--polly/lib/Transform/Simplify.cpp5
2 files changed, 28 insertions, 30 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index a50e1a7..ba46235 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -1773,40 +1773,39 @@ void Scop::removeStmts(function_ref<bool(ScopStmt &)> ShouldDelete,
}
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) {
diff --git a/polly/lib/Transform/Simplify.cpp b/polly/lib/Transform/Simplify.cpp
index f3b8bf8..d699aa4 100644
--- a/polly/lib/Transform/Simplify.cpp
+++ b/polly/lib/Transform/Simplify.cpp
@@ -169,12 +169,11 @@ private:
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();